OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 10 #include "chrome/browser/bookmarks/bookmark_model.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class TwoClientLiveBookmarksSyncTest : public LiveSyncTest { | 29 class TwoClientLiveBookmarksSyncTest : public LiveSyncTest { |
30 public: | 30 public: |
31 TwoClientLiveBookmarksSyncTest() { | 31 TwoClientLiveBookmarksSyncTest() { |
32 // This makes sure browser is visible and active while running test. | 32 // This makes sure browser is visible and active while running test. |
33 InProcessBrowserTest::set_show_window(true); | 33 InProcessBrowserTest::set_show_window(true); |
34 // Set the initial timeout value to 5 min. | 34 // Set the initial timeout value to 5 min. |
35 InProcessBrowserTest::SetInitialTimeoutInMS(300000); | 35 InProcessBrowserTest::SetInitialTimeoutInMS(300000); |
36 } | 36 } |
37 virtual ~TwoClientLiveBookmarksSyncTest() {} | 37 virtual ~TwoClientLiveBookmarksSyncTest() {} |
38 bool SetupSync() { | 38 bool SetupSync() { |
39 profile2_.reset(MakeProfile(L"client2")); | 39 profile2_.reset(MakeProfile(FILE_PATH_LITERAL("client2"))); |
40 client1_.reset(new ProfileSyncServiceTestHarness( | 40 client1_.reset(new ProfileSyncServiceTestHarness( |
41 browser()->profile(), username_, password_)); | 41 browser()->profile(), username_, password_)); |
42 client2_.reset(new ProfileSyncServiceTestHarness( | 42 client2_.reset(new ProfileSyncServiceTestHarness( |
43 profile2_.get(), username_, password_)); | 43 profile2_.get(), username_, password_)); |
44 if (ShouldSetupSyncWithRace()) { | 44 if (ShouldSetupSyncWithRace()) { |
45 return client1_->SetupSync() && client2_->SetupSync(); | 45 return client1_->SetupSync() && client2_->SetupSync(); |
46 } else { | 46 } else { |
47 bool result_client1 = client1_->SetupSync(); | 47 bool result_client1 = client1_->SetupSync(); |
48 client1()->AwaitSyncCycleCompletion("Initial setup"); | 48 client1()->AwaitSyncCycleCompletion("Initial setup"); |
49 return result_client1 && client2_->SetupSync(); | 49 return result_client1 && client2_->SetupSync(); |
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 // Let's compare and make sure both bookmark models are same after sync. | 2354 // Let's compare and make sure both bookmark models are same after sync. |
2355 verifier->ExpectMatch(model_one); | 2355 verifier->ExpectMatch(model_one); |
2356 verifier->ExpectMatch(model_two); | 2356 verifier->ExpectMatch(model_two); |
2357 | 2357 |
2358 Cleanup(); | 2358 Cleanup(); |
2359 } | 2359 } |
2360 | 2360 |
2361 // Test Scribe ID - 373508. | 2361 // Test Scribe ID - 373508. |
2362 IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, | 2362 IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, |
2363 MC_SimpleMergeOfDifferentBMModels) { | 2363 MC_SimpleMergeOfDifferentBMModels) { |
2364 set_profile2(MakeProfile(L"client2")); | 2364 set_profile2(MakeProfile(FILE_PATH_LITERAL("client2"))); |
2365 BookmarkModel* model_one = browser()->profile()->GetBookmarkModel(); | 2365 BookmarkModel* model_one = browser()->profile()->GetBookmarkModel(); |
2366 BookmarkModel* model_two = profile2()->GetBookmarkModel(); | 2366 BookmarkModel* model_two = profile2()->GetBookmarkModel(); |
2367 LiveSyncTest::BlockUntilLoaded(model_two); | 2367 LiveSyncTest::BlockUntilLoaded(model_two); |
2368 | 2368 |
2369 const BookmarkNode* bbn_one = model_one->GetBookmarkBarNode(); | 2369 const BookmarkNode* bbn_one = model_one->GetBookmarkBarNode(); |
2370 const BookmarkNode* bbn_two = model_two->GetBookmarkBarNode(); | 2370 const BookmarkNode* bbn_two = model_two->GetBookmarkBarNode(); |
2371 | 2371 |
2372 // Let's add same bookmarks (without favicon) to both clients. | 2372 // Let's add same bookmarks (without favicon) to both clients. |
2373 for (int index = 0; index < 3; index++) { | 2373 for (int index = 0; index < 3; index++) { |
2374 wstring title(L"TestBookmark"); | 2374 wstring title(L"TestBookmark"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2423 // Let's compare and make sure both bookmark models are same after sync. | 2423 // Let's compare and make sure both bookmark models are same after sync. |
2424 BookmarkModelVerifier::ExpectModelsMatchIncludingFavicon( | 2424 BookmarkModelVerifier::ExpectModelsMatchIncludingFavicon( |
2425 model_one, model_two, false); | 2425 model_one, model_two, false); |
2426 | 2426 |
2427 Cleanup(); | 2427 Cleanup(); |
2428 } | 2428 } |
2429 | 2429 |
2430 // Test Scribe ID - 386586. | 2430 // Test Scribe ID - 386586. |
2431 IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, | 2431 IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, |
2432 MC_MergeSimpleBMHierarchyUnderBMBar) { | 2432 MC_MergeSimpleBMHierarchyUnderBMBar) { |
2433 set_profile2(MakeProfile(L"client2")); | 2433 set_profile2(MakeProfile(FILE_PATH_LITERAL("client2"))); |
2434 BookmarkModel* model_one = browser()->profile()->GetBookmarkModel(); | 2434 BookmarkModel* model_one = browser()->profile()->GetBookmarkModel(); |
2435 BookmarkModel* model_two = profile2()->GetBookmarkModel(); | 2435 BookmarkModel* model_two = profile2()->GetBookmarkModel(); |
2436 LiveSyncTest::BlockUntilLoaded(model_two); | 2436 LiveSyncTest::BlockUntilLoaded(model_two); |
2437 | 2437 |
2438 const BookmarkNode* bbn_one = model_one->GetBookmarkBarNode(); | 2438 const BookmarkNode* bbn_one = model_one->GetBookmarkBarNode(); |
2439 const BookmarkNode* bbn_two = model_two->GetBookmarkBarNode(); | 2439 const BookmarkNode* bbn_two = model_two->GetBookmarkBarNode(); |
2440 | 2440 |
2441 // Let's add same bookmarks (without favicon) to both clients. | 2441 // Let's add same bookmarks (without favicon) to both clients. |
2442 for (int index = 0; index < 3 ; index++) { | 2442 for (int index = 0; index < 3 ; index++) { |
2443 wstring title(L"TestBookmark"); | 2443 wstring title(L"TestBookmark"); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2480 // Let's compare and make sure both bookmark models are same after sync. | 2480 // Let's compare and make sure both bookmark models are same after sync. |
2481 BookmarkModelVerifier::ExpectModelsMatchIncludingFavicon( | 2481 BookmarkModelVerifier::ExpectModelsMatchIncludingFavicon( |
2482 model_one, model_two, false); | 2482 model_one, model_two, false); |
2483 | 2483 |
2484 Cleanup(); | 2484 Cleanup(); |
2485 } | 2485 } |
2486 | 2486 |
2487 // Test Scribe ID - 386589. | 2487 // Test Scribe ID - 386589. |
2488 IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, | 2488 IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest, |
2489 MC_MergeSimpleBMHierarchyEqualSetsUnderBMBar) { | 2489 MC_MergeSimpleBMHierarchyEqualSetsUnderBMBar) { |
2490 set_profile2(MakeProfile(L"client2")); | 2490 set_profile2(MakeProfile(FILE_PATH_LITERAL("client2"))); |
2491 BookmarkModel* model_one = browser()->profile()->GetBookmarkModel(); | 2491 BookmarkModel* model_one = browser()->profile()->GetBookmarkModel(); |
2492 BookmarkModel* model_two = profile2()->GetBookmarkModel(); | 2492 BookmarkModel* model_two = profile2()->GetBookmarkModel(); |
2493 LiveSyncTest::BlockUntilLoaded(model_two); | 2493 LiveSyncTest::BlockUntilLoaded(model_two); |
2494 | 2494 |
2495 const BookmarkNode* bbn_one = model_one->GetBookmarkBarNode(); | 2495 const BookmarkNode* bbn_one = model_one->GetBookmarkBarNode(); |
2496 const BookmarkNode* bbn_two = model_two->GetBookmarkBarNode(); | 2496 const BookmarkNode* bbn_two = model_two->GetBookmarkBarNode(); |
2497 | 2497 |
2498 // Let's add same bookmarks (without favicon) to both clients. | 2498 // Let's add same bookmarks (without favicon) to both clients. |
2499 for (int index = 0; index < 3 ; index++) { | 2499 for (int index = 0; index < 3 ; index++) { |
2500 wstring title(L"TestBookmark"); | 2500 wstring title(L"TestBookmark"); |
(...skipping 20 matching lines...) Expand all Loading... |
2521 // Wait for changes to propagate. | 2521 // Wait for changes to propagate. |
2522 ASSERT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1())); | 2522 ASSERT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1())); |
2523 // Let's make sure there aren't any duplicates after sync. | 2523 // Let's make sure there aren't any duplicates after sync. |
2524 BookmarkModelVerifier::VerifyNoDuplicates(model_one); | 2524 BookmarkModelVerifier::VerifyNoDuplicates(model_one); |
2525 // Let's compare and make sure both bookmark models are same after sync. | 2525 // Let's compare and make sure both bookmark models are same after sync. |
2526 BookmarkModelVerifier::ExpectModelsMatchIncludingFavicon( | 2526 BookmarkModelVerifier::ExpectModelsMatchIncludingFavicon( |
2527 model_one, model_two, false); | 2527 model_one, model_two, false); |
2528 | 2528 |
2529 Cleanup(); | 2529 Cleanup(); |
2530 } | 2530 } |
OLD | NEW |