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

Side by Side Diff: chrome/test/live_sync/two_client_live_preferences_sync_test.cc

Issue 1803001: Fix second-profile dir so that it's a sibling of the first; eliminate a FromWStringHack. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Formatting fixes. Created 10 years, 7 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
« no previous file with comments | « chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc ('k') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/browser.h" 6 #include "chrome/browser/browser.h"
7 #include "chrome/browser/pref_service.h" 7 #include "chrome/browser/pref_service.h"
8 #include "chrome/browser/profile.h" 8 #include "chrome/browser/profile.h"
9 #include "chrome/browser/sync/profile_sync_service.h" 9 #include "chrome/browser/sync/profile_sync_service.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 #include "chrome/test/live_sync/profile_sync_service_test_harness.h" 11 #include "chrome/test/live_sync/profile_sync_service_test_harness.h"
12 #include "chrome/test/live_sync/live_sync_test.h" 12 #include "chrome/test/live_sync/live_sync_test.h"
13 13
14 class TwoClientLivePreferencesSyncTest : public LiveSyncTest { 14 class TwoClientLivePreferencesSyncTest : public LiveSyncTest {
15 protected: 15 protected:
16 TwoClientLivePreferencesSyncTest() { 16 TwoClientLivePreferencesSyncTest() {
17 // This makes sure browser is visible and active while running test. 17 // This makes sure browser is visible and active while running test.
18 InProcessBrowserTest::set_show_window(true); 18 InProcessBrowserTest::set_show_window(true);
19 // Set the initial timeout value to 5 min. 19 // Set the initial timeout value to 5 min.
20 InProcessBrowserTest::SetInitialTimeoutInMS(300000); 20 InProcessBrowserTest::SetInitialTimeoutInMS(300000);
21 } 21 }
22 ~TwoClientLivePreferencesSyncTest() {} 22 ~TwoClientLivePreferencesSyncTest() {}
23 23
24 void SetupSync() { 24 void SetupSync() {
25 client1_.reset(new ProfileSyncServiceTestHarness( 25 client1_.reset(new ProfileSyncServiceTestHarness(
26 browser()->profile(), username_, password_)); 26 browser()->profile(), username_, password_));
27 profile2_.reset(MakeProfile(L"client2")); 27 profile2_.reset(MakeProfile(FILE_PATH_LITERAL("client2")));
28 client2_.reset(new ProfileSyncServiceTestHarness( 28 client2_.reset(new ProfileSyncServiceTestHarness(
29 profile2_.get(), username_, password_)); 29 profile2_.get(), username_, password_));
30 EXPECT_TRUE(client1_->SetupSync()); 30 EXPECT_TRUE(client1_->SetupSync());
31 EXPECT_TRUE(client1_->AwaitSyncCycleCompletion("Initial setup 1")); 31 EXPECT_TRUE(client1_->AwaitSyncCycleCompletion("Initial setup 1"));
32 EXPECT_TRUE(client2_->SetupSync()); 32 EXPECT_TRUE(client2_->SetupSync());
33 EXPECT_TRUE(client2_->AwaitSyncCycleCompletion("Initial setup 2")); 33 EXPECT_TRUE(client2_->AwaitSyncCycleCompletion("Initial setup 2"));
34 } 34 }
35 35
36 void Cleanup() { 36 void Cleanup() {
37 client2_.reset(); 37 client2_.reset();
(...skipping 13 matching lines...) Expand all
51 51
52 DISALLOW_COPY_AND_ASSIGN(TwoClientLivePreferencesSyncTest); 52 DISALLOW_COPY_AND_ASSIGN(TwoClientLivePreferencesSyncTest);
53 }; 53 };
54 54
55 IN_PROC_BROWSER_TEST_F(TwoClientLivePreferencesSyncTest, Sanity) { 55 IN_PROC_BROWSER_TEST_F(TwoClientLivePreferencesSyncTest, Sanity) {
56 SetupSync(); 56 SetupSync();
57 57
58 EXPECT_EQ(false, prefs1()->GetBoolean(prefs::kHomePageIsNewTabPage)); 58 EXPECT_EQ(false, prefs1()->GetBoolean(prefs::kHomePageIsNewTabPage));
59 EXPECT_EQ(false, prefs2()->GetBoolean(prefs::kHomePageIsNewTabPage)); 59 EXPECT_EQ(false, prefs2()->GetBoolean(prefs::kHomePageIsNewTabPage));
60 60
61 PrefService* expected = LiveSyncTest::MakeProfile(L"verifier")->GetPrefs(); 61 PrefService* expected = LiveSyncTest::MakeProfile(
62 FILE_PATH_LITERAL("verifier"))->GetPrefs();
62 expected->SetBoolean(prefs::kHomePageIsNewTabPage, true); 63 expected->SetBoolean(prefs::kHomePageIsNewTabPage, true);
63 64
64 prefs1()->SetBoolean(prefs::kHomePageIsNewTabPage, true); 65 prefs1()->SetBoolean(prefs::kHomePageIsNewTabPage, true);
65 EXPECT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1())); 66 EXPECT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1()));
66 67
67 EXPECT_EQ(expected->GetBoolean(prefs::kHomePageIsNewTabPage), 68 EXPECT_EQ(expected->GetBoolean(prefs::kHomePageIsNewTabPage),
68 prefs1()->GetBoolean(prefs::kHomePageIsNewTabPage)); 69 prefs1()->GetBoolean(prefs::kHomePageIsNewTabPage));
69 EXPECT_EQ(expected->GetBoolean(prefs::kHomePageIsNewTabPage), 70 EXPECT_EQ(expected->GetBoolean(prefs::kHomePageIsNewTabPage),
70 prefs2()->GetBoolean(prefs::kHomePageIsNewTabPage)); 71 prefs2()->GetBoolean(prefs::kHomePageIsNewTabPage));
71 72
72 Cleanup(); 73 Cleanup();
73 } 74 }
74 75
75 IN_PROC_BROWSER_TEST_F(TwoClientLivePreferencesSyncTest, Race) { 76 IN_PROC_BROWSER_TEST_F(TwoClientLivePreferencesSyncTest, Race) {
76 SetupSync(); 77 SetupSync();
77 78
78 prefs1()->SetString(prefs::kHomePage, L"http://www.google.com/1"); 79 prefs1()->SetString(prefs::kHomePage, L"http://www.google.com/1");
79 prefs2()->SetString(prefs::kHomePage, L"http://www.google.com/2"); 80 prefs2()->SetString(prefs::kHomePage, L"http://www.google.com/2");
80 81
81 EXPECT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1())); 82 EXPECT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1()));
82 83
83 EXPECT_EQ(prefs1()->GetString(prefs::kHomePage), 84 EXPECT_EQ(prefs1()->GetString(prefs::kHomePage),
84 prefs2()->GetString(prefs::kHomePage)); 85 prefs2()->GetString(prefs::kHomePage));
85 86
86 Cleanup(); 87 Cleanup();
87 } 88 }
OLDNEW
« no previous file with comments | « chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698