OLD | NEW |
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" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 scoped_ptr<ProfileSyncServiceTestHarness> client1_; | 48 scoped_ptr<ProfileSyncServiceTestHarness> client1_; |
49 scoped_ptr<ProfileSyncServiceTestHarness> client2_; | 49 scoped_ptr<ProfileSyncServiceTestHarness> client2_; |
50 scoped_ptr<Profile> profile2_; | 50 scoped_ptr<Profile> profile2_; |
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(prefs1()->GetBoolean(prefs::kHomePageIsNewTabPage), |
59 EXPECT_EQ(false, prefs2()->GetBoolean(prefs::kHomePageIsNewTabPage)); | 59 prefs2()->GetBoolean(prefs::kHomePageIsNewTabPage)); |
60 | 60 |
61 PrefService* expected = LiveSyncTest::MakeProfile( | 61 PrefService* expected = LiveSyncTest::MakeProfile( |
62 FILE_PATH_LITERAL("verifier"))->GetPrefs(); | 62 FILE_PATH_LITERAL("verifier"))->GetPrefs(); |
63 expected->SetBoolean(prefs::kHomePageIsNewTabPage, true); | 63 bool value = !expected->GetBoolean(prefs::kHomePageIsNewTabPage); |
| 64 expected->SetBoolean(prefs::kHomePageIsNewTabPage, value); |
64 | 65 |
65 prefs1()->SetBoolean(prefs::kHomePageIsNewTabPage, true); | 66 prefs1()->SetBoolean(prefs::kHomePageIsNewTabPage, value); |
66 EXPECT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1())); | 67 EXPECT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1())); |
67 | 68 |
68 EXPECT_EQ(expected->GetBoolean(prefs::kHomePageIsNewTabPage), | 69 EXPECT_EQ(expected->GetBoolean(prefs::kHomePageIsNewTabPage), |
69 prefs1()->GetBoolean(prefs::kHomePageIsNewTabPage)); | 70 prefs1()->GetBoolean(prefs::kHomePageIsNewTabPage)); |
70 EXPECT_EQ(expected->GetBoolean(prefs::kHomePageIsNewTabPage), | 71 EXPECT_EQ(expected->GetBoolean(prefs::kHomePageIsNewTabPage), |
71 prefs2()->GetBoolean(prefs::kHomePageIsNewTabPage)); | 72 prefs2()->GetBoolean(prefs::kHomePageIsNewTabPage)); |
72 | 73 |
73 Cleanup(); | 74 Cleanup(); |
74 } | 75 } |
75 | 76 |
76 IN_PROC_BROWSER_TEST_F(TwoClientLivePreferencesSyncTest, Race) { | 77 IN_PROC_BROWSER_TEST_F(TwoClientLivePreferencesSyncTest, Race) { |
77 SetupSync(); | 78 SetupSync(); |
78 | 79 |
79 prefs1()->SetString(prefs::kHomePage, L"http://www.google.com/1"); | 80 prefs1()->SetString(prefs::kHomePage, L"http://www.google.com/1"); |
80 prefs2()->SetString(prefs::kHomePage, L"http://www.google.com/2"); | 81 prefs2()->SetString(prefs::kHomePage, L"http://www.google.com/2"); |
81 | 82 |
82 EXPECT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1())); | 83 EXPECT_TRUE(client2()->AwaitMutualSyncCycleCompletion(client1())); |
83 | 84 |
84 EXPECT_EQ(prefs1()->GetString(prefs::kHomePage), | 85 EXPECT_EQ(prefs1()->GetString(prefs::kHomePage), |
85 prefs2()->GetString(prefs::kHomePage)); | 86 prefs2()->GetString(prefs::kHomePage)); |
86 | 87 |
87 Cleanup(); | 88 Cleanup(); |
88 } | 89 } |
OLD | NEW |