Lines Matching refs:tracker
22 SyncedSessionTracker tracker;
23 SyncedSession* session1 = tracker.GetSession("tag");
24 SyncedSession* session2 = tracker.GetSession("tag2");
25 ASSERT_EQ(session1, tracker.GetSession("tag"));
31 SyncedSessionTracker tracker;
32 SessionTab* tab = tracker.GetTab("tag", 0, 0);
33 ASSERT_EQ(tab, tracker.GetTab("tag", 0, 0));
38 SyncedSessionTracker tracker;
39 tracker.PutWindowInSession("tag", 0);
40 SyncedSession* session = tracker.GetSession("tag");
46 SyncedSessionTracker tracker;
47 tracker.PutWindowInSession("tag", 10);
48 tracker.PutTabInWindow("tag", 10, 15, 0); // win id 10, tab id 15, tab ind 0.
49 SyncedSession* session = tracker.GetSession("tag");
52 ASSERT_EQ(tracker.GetTab("tag", 15, 1), session->windows[10]->tabs[0]);
57 SyncedSessionTracker tracker;
59 ASSERT_FALSE(tracker.LookupAllForeignSessions(&sessions));
60 tracker.GetSession("tag1");
61 tracker.GetSession("tag2");
62 tracker.PutWindowInSession("tag1", 0);
63 tracker.PutTabInWindow("tag1", 0, 15, 0);
64 SessionTab* tab = tracker.GetTab("tag1", 15, 1);
69 ASSERT_TRUE(tracker.LookupAllForeignSessions(&sessions));
76 SyncedSessionTracker tracker;
78 ASSERT_FALSE(tracker.LookupSessionWindows("tag1", &windows));
79 tracker.GetSession("tag1");
80 tracker.PutWindowInSession("tag1", 0);
81 tracker.PutWindowInSession("tag1", 2);
82 tracker.GetSession("tag2");
83 tracker.PutWindowInSession("tag2", 0);
84 tracker.PutWindowInSession("tag2", 2);
85 ASSERT_TRUE(tracker.LookupSessionWindows("tag1", &windows));
93 SyncedSessionTracker tracker;
95 ASSERT_FALSE(tracker.LookupSessionTab("tag1", 5, &tab));
96 tracker.GetSession("tag1");
97 tracker.PutWindowInSession("tag1", 0);
98 tracker.PutTabInWindow("tag1", 0, 5, 0);
99 ASSERT_TRUE(tracker.LookupSessionTab("tag1", 5, &tab));
107 SyncedSessionTracker tracker;
110 ASSERT_TRUE(tracker.Empty());
111 ASSERT_EQ(0U, tracker.num_synced_sessions());
112 ASSERT_EQ(0U, tracker.num_synced_tabs(tag1));
113 tabs1.push_back(tracker.GetTab(tag1, 0, 0));
114 tabs1.push_back(tracker.GetTab(tag1, 1, 1));
115 tabs1.push_back(tracker.GetTab(tag1, 2, 2));
116 ASSERT_EQ(3U, tracker.num_synced_tabs(tag1));
117 ASSERT_EQ(0U, tracker.num_synced_sessions());
118 temp_tab = tracker.GetTab(tag1, 0, 0); // Already created.
119 ASSERT_EQ(3U, tracker.num_synced_tabs(tag1));
120 ASSERT_EQ(0U, tracker.num_synced_sessions());
122 tabs2.push_back(tracker.GetTab(tag2, 0, 0));
123 ASSERT_EQ(1U, tracker.num_synced_tabs(tag2));
124 ASSERT_EQ(0U, tracker.num_synced_sessions());
125 ASSERT_FALSE(tracker.DeleteSession(tag3));
127 SyncedSession* session = tracker.GetSession(tag1);
128 SyncedSession* session2 = tracker.GetSession(tag2);
129 SyncedSession* session3 = tracker.GetSession(tag3);
130 ASSERT_EQ(3U, tracker.num_synced_sessions());
137 ASSERT_TRUE(tracker.DeleteSession(tag3));
138 ASSERT_EQ(2U, tracker.num_synced_sessions());
140 tracker.PutWindowInSession(tag1, 0); // Create a window.
141 tracker.PutTabInWindow(tag1, 0, 2, 0); // No longer unmapped.
142 ASSERT_EQ(3U, tracker.num_synced_tabs(tag1)); // Has not changed.
145 ASSERT_TRUE(tracker.LookupSessionTab(tag1, 0, &tab_ptr));
147 ASSERT_TRUE(tracker.LookupSessionTab(tag1, 2, &tab_ptr));
149 ASSERT_FALSE(tracker.LookupSessionTab(tag1, 3, &tab_ptr));
153 ASSERT_TRUE(tracker.LookupSessionWindows(tag1, &windows));
155 ASSERT_TRUE(tracker.LookupSessionWindows(tag2, &windows));
160 ASSERT_FALSE(tracker.LookupAllForeignSessions(&sessions));
162 tracker.Clear();
163 ASSERT_EQ(0U, tracker.num_synced_tabs(tag1));
164 ASSERT_EQ(0U, tracker.num_synced_tabs(tag2));
165 ASSERT_EQ(0U, tracker.num_synced_sessions());
169 SyncedSessionTracker tracker;
170 ASSERT_TRUE(tracker.Empty());
180 SessionTab* tab = tracker.GetTab(tag, rand_tab_num, rand_tab_num + 1);
187 SyncedSessionTracker tracker;
193 tracker.GetTab(tag1, 1, 1);
194 tracker.GetTab(tag1, 2, 2);
195 EXPECT_TRUE(tracker.LookupTabNodeIds(tag1, &result));
199 EXPECT_FALSE(tracker.LookupTabNodeIds(tag2, &result));
201 tracker.PutWindowInSession(tag1, 0);
202 tracker.PutTabInWindow(tag1, 0, 3, 0);
203 EXPECT_TRUE(tracker.LookupTabNodeIds(tag1, &result));
206 tracker.GetTab(tag1, 3, 3);
207 EXPECT_TRUE(tracker.LookupTabNodeIds(tag1, &result));
211 tracker.GetTab(tag2, 1, 21);
212 tracker.GetTab(tag2, 2, 22);
213 EXPECT_TRUE(tracker.LookupTabNodeIds(tag2, &result));
217 EXPECT_TRUE(tracker.LookupTabNodeIds(tag1, &result));
222 EXPECT_FALSE(tracker.LookupTabNodeIds(tag3, &result));
223 tracker.PutWindowInSession(tag3, 1);
224 tracker.PutTabInWindow(tag3, 1, 5, 0);
225 EXPECT_TRUE(tracker.LookupTabNodeIds(tag3, &result));
227 EXPECT_TRUE(tracker.DeleteSession(tag3));
228 EXPECT_FALSE(tracker.LookupTabNodeIds(tag3, &result));
230 EXPECT_TRUE(tracker.DeleteSession(tag1));
231 EXPECT_FALSE(tracker.LookupTabNodeIds(tag1, &result));
232 EXPECT_TRUE(tracker.LookupTabNodeIds(tag2, &result));
236 EXPECT_TRUE(tracker.DeleteSession(tag2));
237 EXPECT_FALSE(tracker.LookupTabNodeIds(tag2, &result));
241 SyncedSessionTracker tracker;
242 ASSERT_TRUE(tracker.Empty());
247 SyncedSession* session1= tracker.GetSession(tag1);
248 tracker.PutWindowInSession(tag1, 0);
249 tracker.PutTabInWindow(tag1, 0, 0, 0);
250 tracker.PutTabInWindow(tag1, 0, 1, 1);
251 tracker.GetTab(tag1, 2, 3U)->window_id.set_id(0); // Will be unmapped.
252 tracker.GetTab(tag1, 3, 4U)->window_id.set_id(0); // Will be unmapped.
253 tracker.PutWindowInSession(tag1, 1);
254 tracker.PutTabInWindow(tag1, 1, 4, 0);
255 tracker.PutTabInWindow(tag1, 1, 5, 1);
259 ASSERT_EQ(6U, tracker.num_synced_tabs(tag1));
262 SyncedSession* session2 = tracker.GetSession(tag2);
263 tracker.PutWindowInSession(tag2, 2);
264 tracker.PutTabInWindow(tag2, 2, 1, 0);
267 ASSERT_EQ(1U, tracker.num_synced_tabs(tag2));
275 tracker.GetTab(tag1, 6, 7U);
276 tracker.ResetSessionTracking(tag1);
277 tracker.PutWindowInSession(tag1, 0);
278 tracker.PutTabInWindow(tag1, 0, 0, 0);
280 tracker.PutTabInWindow(tag1, 0, 2, 1); // No longer unmapped.
282 tracker.PutTabInWindow(tag1, 0, 4, 2); // Moved from window 1.
284 tracker.PutTabInWindow(tag1, 0, 6, 3); // No longer unmapped.
286 tracker.CleanupSession(tag1);
293 ASSERT_EQ(2U, tracker.num_synced_sessions());
294 ASSERT_EQ(4U, tracker.num_synced_tabs(tag1));
295 ASSERT_EQ(1U, tracker.num_synced_tabs(tag2));