Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc

Issue 10081021: [Sync] Re-enable flaky session integration tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_vector.h" 5 #include "base/memory/scoped_vector.h"
6 #include "chrome/browser/sessions/session_service.h" 6 #include "chrome/browser/sessions/session_service.h"
7 #include "chrome/browser/sync/profile_sync_service_harness.h" 7 #include "chrome/browser/sync/profile_sync_service_harness.h"
8 #include "chrome/browser/sync/test/integration/passwords_helper.h" 8 #include "chrome/browser/sync/test/integration/passwords_helper.h"
9 #include "chrome/browser/sync/test/integration/sessions_helper.h" 9 #include "chrome/browser/sync/test/integration/sessions_helper.h"
10 #include "chrome/browser/sync/test/integration/sync_test.h" 10 #include "chrome/browser/sync/test/integration/sync_test.h"
(...skipping 12 matching lines...) Expand all
23 23
24 class TwoClientSessionsSyncTest : public SyncTest { 24 class TwoClientSessionsSyncTest : public SyncTest {
25 public: 25 public:
26 TwoClientSessionsSyncTest() : SyncTest(TWO_CLIENT) {} 26 TwoClientSessionsSyncTest() : SyncTest(TWO_CLIENT) {}
27 virtual ~TwoClientSessionsSyncTest() {} 27 virtual ~TwoClientSessionsSyncTest() {}
28 28
29 private: 29 private:
30 DISALLOW_COPY_AND_ASSIGN(TwoClientSessionsSyncTest); 30 DISALLOW_COPY_AND_ASSIGN(TwoClientSessionsSyncTest);
31 }; 31 };
32 32
33 static const char* kValidPassphrase = "passphrase!";
34 static const char* kURL1 = "http://127.0.0.1/bubba1"; 33 static const char* kURL1 = "http://127.0.0.1/bubba1";
35 static const char* kURL2 = "http://127.0.0.1/bubba2"; 34 static const char* kURL2 = "http://127.0.0.1/bubba2";
36 35
37 // TODO(zea): Test each individual session command we care about separately. 36 // TODO(zea): Test each individual session command we care about separately.
38 // (as well as multi-window). We're currently only checking basic single-window/ 37 // (as well as multi-window). We're currently only checking basic single-window/
39 // single-tab functionality. 38 // single-tab functionality.
40 39
41 // All tests involving changes to the sessions appear to be flaky, especially
42 // on windows.
43 // crbug.com/85294
44
45 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, 40 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
46 DISABLED_SingleClientChanged) { 41 SingleClientChanged) {
47 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 42 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
48 43
49 ASSERT_TRUE(CheckInitialState(0)); 44 ASSERT_TRUE(CheckInitialState(0));
50 ASSERT_TRUE(CheckInitialState(1)); 45 ASSERT_TRUE(CheckInitialState(1));
51 46
52 ScopedWindowMap client0_windows; 47 ScopedWindowMap client0_windows;
53 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1), 48 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1),
54 client0_windows.GetMutable())); 49 client0_windows.GetMutable()));
55 50
56 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 51 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
(...skipping 19 matching lines...) Expand all
76 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS)); 71 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS));
77 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS)); 72 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS));
78 73
79 // Should enable encryption for all other types as well. Just check a subset. 74 // Should enable encryption for all other types as well. Just check a subset.
80 ASSERT_TRUE(IsEncrypted(1, syncable::PREFERENCES)); 75 ASSERT_TRUE(IsEncrypted(1, syncable::PREFERENCES));
81 ASSERT_TRUE(IsEncrypted(1, syncable::BOOKMARKS)); 76 ASSERT_TRUE(IsEncrypted(1, syncable::BOOKMARKS));
82 ASSERT_TRUE(IsEncrypted(1, syncable::APPS)); 77 ASSERT_TRUE(IsEncrypted(1, syncable::APPS));
83 } 78 }
84 79
85 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, 80 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
86 DISABLED_SingleClientEnabledEncryptionAndChanged) { 81 SingleClientEnabledEncryptionAndChanged) {
87 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 82 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
88 83
89 ASSERT_TRUE(CheckInitialState(0)); 84 ASSERT_TRUE(CheckInitialState(0));
90 ASSERT_TRUE(CheckInitialState(1)); 85 ASSERT_TRUE(CheckInitialState(1));
91 86
92 ScopedWindowMap client0_windows; 87 ScopedWindowMap client0_windows;
93 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1), 88 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1),
94 client0_windows.GetMutable())); 89 client0_windows.GetMutable()));
95 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS)); 90 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS));
96 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 91 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
(...skipping 15 matching lines...) Expand all
112 ASSERT_TRUE(CheckInitialState(0)); 107 ASSERT_TRUE(CheckInitialState(0));
113 ASSERT_TRUE(CheckInitialState(1)); 108 ASSERT_TRUE(CheckInitialState(1));
114 109
115 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS)); 110 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS));
116 ASSERT_TRUE(EnableEncryption(1, syncable::SESSIONS)); 111 ASSERT_TRUE(EnableEncryption(1, syncable::SESSIONS));
117 ASSERT_TRUE(AwaitQuiescence()); 112 ASSERT_TRUE(AwaitQuiescence());
118 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS)); 113 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS));
119 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS)); 114 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS));
120 } 115 }
121 116
122 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, DISABLED_BothChanged) { 117 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, BothChanged) {
123 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 118 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
124 119
125 ASSERT_TRUE(CheckInitialState(0)); 120 ASSERT_TRUE(CheckInitialState(0));
126 ASSERT_TRUE(CheckInitialState(1)); 121 ASSERT_TRUE(CheckInitialState(1));
127 122
128 // Open tabs on both clients and retain window information. 123 // Open tabs on both clients and retain window information.
129 ScopedWindowMap client0_windows; 124 ScopedWindowMap client0_windows;
130 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL2), 125 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL2),
131 client0_windows.GetMutable())); 126 client0_windows.GetMutable()));
132 ScopedWindowMap client1_windows; 127 ScopedWindowMap client1_windows;
(...skipping 10 matching lines...) Expand all
143 ASSERT_TRUE(GetSessionData(1, &sessions1)); 138 ASSERT_TRUE(GetSessionData(1, &sessions1));
144 139
145 // Verify client 1's foreign session matches client 0's current window and 140 // Verify client 1's foreign session matches client 0's current window and
146 // vice versa. 141 // vice versa.
147 ASSERT_EQ(1U, sessions0.size()); 142 ASSERT_EQ(1U, sessions0.size());
148 ASSERT_EQ(1U, sessions1.size()); 143 ASSERT_EQ(1U, sessions1.size());
149 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get())); 144 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get()));
150 ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows.Get())); 145 ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows.Get()));
151 } 146 }
152 147
153 // Flaky (number of conflicting nodes is off). http://crbug.com/85294.
154 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
155 DISABLED_FirstChangesAndSetsPassphrase) {
156 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
157
158 ASSERT_TRUE(CheckInitialState(0));
159 ASSERT_TRUE(CheckInitialState(1));
160
161 ScopedWindowMap client0_windows;
162 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1),
163 client0_windows.GetMutable()));
164
165 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS));
166 SetEncryptionPassphrase(0, kValidPassphrase, ProfileSyncService::EXPLICIT);
167 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted());
168 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
169 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
170 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
171 num_simple_conflicts);
172 // We have two meta nodes (one for each client), the one tab node, plus the
173 // basic preference/themes/search engines items.
174 ASSERT_EQ(NumberOfDefaultSyncItems() + 3,
175 GetClient(1)->GetLastSessionSnapshot()->
176 num_encryption_conflicts); // The encrypted nodes.
177
178 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
179 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase));
180 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
181 ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
182
183 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS));
184 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS));
185 // Get foreign session data from client 0 and 1.
186 SyncedSessionVector sessions1;
187 ASSERT_TRUE(GetSessionData(1, &sessions1));
188
189 // Verify client 1's foreign session matches client 0's current window and
190 // vice versa.
191 ASSERT_EQ(1U, sessions1.size());
192 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get()));
193 }
194
195 // Flaky (number of conflicting nodes is off). http://crbug.com/85294.
196 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
197 DISABLED_FirstChangesWhileSecondWaitingForPassphrase) {
198 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
199
200 ASSERT_TRUE(CheckInitialState(0));
201 ASSERT_TRUE(CheckInitialState(1));
202
203 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS));
204 SetEncryptionPassphrase(0, kValidPassphrase, ProfileSyncService::EXPLICIT);
205 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted());
206 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
207 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
208 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
209 num_simple_conflicts);
210 // We have nine encryption conflicts due to the two meta nodes (one for each
211 // client), plus the basic preference/themes/search engines nodes.
212 ASSERT_EQ(NumberOfDefaultSyncItems() + 2,
213 GetClient(1)->GetLastSessionSnapshot()->
214 num_encryption_conflicts); // The encrypted nodes.
215
216 ScopedWindowMap client0_windows;
217 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1),
218 client0_windows.GetMutable()));
219 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
220 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
221 num_simple_conflicts);
222 ASSERT_EQ(NumberOfDefaultSyncItems() + 3,
223 GetClient(1)->GetLastSessionSnapshot()->
224 num_encryption_conflicts); // The encrypted nodes.
225
226 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
227 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase));
228 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
229 ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
230
231 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS));
232 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS));
233 // Get foreign session data from client 0 and 1.
234 SyncedSessionVector sessions1;
235 ASSERT_TRUE(GetSessionData(1, &sessions1));
236
237 // Verify client 1's foreign session matches client 0's current window and
238 // vice versa.
239 ASSERT_EQ(1U, sessions1.size());
240 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get()));
241 }
242
243 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
244 DISABLED_SecondChangesAfterEncrAndPassphraseChange) {
245 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
246
247 ASSERT_TRUE(CheckInitialState(0));
248 ASSERT_TRUE(CheckInitialState(1));
249
250 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS));
251 SetEncryptionPassphrase(0, kValidPassphrase, ProfileSyncService::EXPLICIT);
252 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted());
253 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
254 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
255 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
256 num_simple_conflicts);
257 // We have two encryption conflicts due to the two meta nodes (one for each
258 // client), plus the basic preference/themes/search engines nodes.
259 ASSERT_EQ(NumberOfDefaultSyncItems() + 2,
260 GetClient(1)->GetLastSessionSnapshot()->
261 num_encryption_conflicts); // The encrypted nodes.
262
263 // These changes are either made with the old passphrase or not encrypted at
264 // all depending on when client 0's changes are propagated.
265 ScopedWindowMap client1_windows;
266 ASSERT_TRUE(OpenTabAndGetLocalWindows(1, GURL(kURL1),
267 client1_windows.GetMutable()));
268
269 // At this point we enter the passphrase, triggering a resync, in which the
270 // local changes of client 1 get sent to client 0.
271 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
272 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase));
273 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
274 ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
275 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
276 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
277 num_encryption_conflicts);
278
279 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS));
280 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS));
281 SyncedSessionVector sessions0;
282 SyncedSessionVector sessions1;
283 ASSERT_TRUE(GetSessionData(0, &sessions0));
284 ASSERT_FALSE(GetSessionData(1, &sessions1));
285 }
286
287 // Flaky (number of conflicting nodes is off). http://crbug.com/85294.
288 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
289 DISABLED_SecondChangesBeforeEncrAndPassphraseChange) {
290 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
291
292 ASSERT_TRUE(CheckInitialState(0));
293 ASSERT_TRUE(CheckInitialState(1));
294
295 // These changes are either made on client 1 without encryption.
296 ScopedWindowMap client1_windows;
297 ASSERT_TRUE(OpenTabAndGetLocalWindows(1, GURL(kURL1),
298 client1_windows.GetMutable()));
299 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
300
301 // Turn encryption on client 0. Client 1's foreign will be encrypted with the
302 // new passphrase and synced back. It will be unable to decrypt it yet.
303 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS));
304 SetEncryptionPassphrase(0, kValidPassphrase, ProfileSyncService::EXPLICIT);
305 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted());
306 ASSERT_TRUE(AwaitQuiescence());
307 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
308 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
309 num_simple_conflicts);
310 // We have three encryption conflicts due to the two meta nodes (one for
311 // each client), the one tab node, plus the basic preference/themes/search
312 // engines nodes.
313 ASSERT_GE(NumberOfDefaultSyncItems() + 3,
314 GetClient(1)->GetLastSessionSnapshot()->
315 num_encryption_conflicts); // The encrypted nodes.
316
317 // At this point we enter the passphrase, triggering a resync.
318 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
319 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase));
320 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
321 ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
322
323 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS));
324 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS));
325 // Client 0's foreign data should match client 1's local data. Client 1's
326 // foreign data is empty because client 0 did not open any tabs.
327 SyncedSessionVector sessions0;
328 SyncedSessionVector sessions1;
329 ASSERT_TRUE(GetSessionData(0, &sessions0));
330 ASSERT_FALSE(GetSessionData(1, &sessions1));
331 ASSERT_EQ(1U, sessions0.size());
332 ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows.Get()));
333 }
334
335 // Flaky (number of conflicting nodes is off). http://crbug.com/85294.
336 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
337 DISABLED_BothChangeWithEncryptionAndPassphrase) {
338 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
339
340 ASSERT_TRUE(CheckInitialState(0));
341 ASSERT_TRUE(CheckInitialState(1));
342
343 SetEncryptionPassphrase(0, kValidPassphrase, ProfileSyncService::EXPLICIT);
344 ASSERT_TRUE(GetClient(0)->AwaitPassphraseAccepted());
345 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
346 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
347
348 // These changes will sync over to client 1, who will be unable to decrypt
349 // them due to the missing passphrase.
350 ScopedWindowMap client0_windows;
351 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1),
352 client0_windows.GetMutable()));
353 ASSERT_TRUE(EnableEncryption(0, syncable::SESSIONS));
354 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
355 ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
356 num_simple_conflicts);
357 // We have three encryption conflicts due to the two meta nodes (one for
358 // each client), the one tab node, plus the basic preference/themes/search
359 // engines nodes.
360 ASSERT_EQ(NumberOfDefaultSyncItems() + 3,
361 GetClient(1)->GetLastSessionSnapshot()->
362 num_encryption_conflicts); // The encrypted nodes.
363
364 ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
365 ASSERT_TRUE(SetDecryptionPassphrase(1, kValidPassphrase));
366 ASSERT_TRUE(GetClient(1)->AwaitPassphraseAccepted());
367 ASSERT_FALSE(GetClient(1)->service()->IsPassphraseRequired());
368 ASSERT_TRUE(GetClient(1)->WaitForTypeEncryption(syncable::SESSIONS));
369
370 // Open windows on client 1, which should automatically be encrypted.
371 ScopedWindowMap client1_windows;
372 ASSERT_TRUE(OpenTabAndGetLocalWindows(1, GURL(kURL2),
373 client1_windows.GetMutable()));
374 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
375
376 ASSERT_TRUE(IsEncrypted(0, syncable::SESSIONS));
377 ASSERT_TRUE(IsEncrypted(1, syncable::SESSIONS));
378 // Get foreign session data from client 0 and 1.
379 SyncedSessionVector sessions0;
380 SyncedSessionVector sessions1;
381 ASSERT_TRUE(GetSessionData(0, &sessions0));
382 ASSERT_TRUE(GetSessionData(1, &sessions1));
383
384 // Verify client 1's foreign session matches client 0's current window and
385 // vice versa.
386 ASSERT_EQ(1U, sessions0.size());
387 ASSERT_EQ(1U, sessions1.size());
388 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get()));
389 ASSERT_TRUE(WindowsMatch(sessions0[0]->windows, *client1_windows.Get()));
390 }
391
392 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, DeleteIdleSession) { 148 IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, DeleteIdleSession) {
393 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 149 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
394 150
395 ASSERT_TRUE(CheckInitialState(0)); 151 ASSERT_TRUE(CheckInitialState(0));
396 ASSERT_TRUE(CheckInitialState(1)); 152 ASSERT_TRUE(CheckInitialState(1));
397 153
398 // Client 0 opened some tabs then went idle. 154 // Client 0 opened some tabs then went idle.
399 ScopedWindowMap client0_windows; 155 ScopedWindowMap client0_windows;
400 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1), 156 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL1),
401 client0_windows.GetMutable())); 157 client0_windows.GetMutable()));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 ASSERT_FALSE(GetSessionData(1, &sessions1)); 195 ASSERT_FALSE(GetSessionData(1, &sessions1));
440 196
441 // Client 0 becomes active again with a new tab. 197 // Client 0 becomes active again with a new tab.
442 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL2), 198 ASSERT_TRUE(OpenTabAndGetLocalWindows(0, GURL(kURL2),
443 client0_windows.GetMutable())); 199 client0_windows.GetMutable()));
444 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 200 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
445 ASSERT_TRUE(GetSessionData(1, &sessions1)); 201 ASSERT_TRUE(GetSessionData(1, &sessions1));
446 ASSERT_EQ(1U, sessions1.size()); 202 ASSERT_EQ(1U, sessions1.size());
447 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get())); 203 ASSERT_TRUE(WindowsMatch(sessions1[0]->windows, *client0_windows.Get()));
448 } 204 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698