1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 #include "base/prefs/pref_service.h"
7 #include "base/strings/stringprintf.h"
8 #include "base/values.h"
9 #include "chrome/browser/sync/test/integration/preferences_helper.h"
10 #include "chrome/browser/sync/test/integration/sync_test.h"
11 #include "chrome/common/pref_names.h"
13 using preferences_helper::AwaitStringPrefMatches
;
14 using preferences_helper::ChangeStringPref
;
15 using preferences_helper::GetPrefs
;
17 class MultipleClientPreferencesSyncTest
: public SyncTest
{
19 MultipleClientPreferencesSyncTest() : SyncTest(MULTIPLE_CLIENT
) {}
20 ~MultipleClientPreferencesSyncTest() override
{}
22 bool TestUsesSelfNotifications() override
{ return false; }
25 DISALLOW_COPY_AND_ASSIGN(MultipleClientPreferencesSyncTest
);
28 IN_PROC_BROWSER_TEST_F(MultipleClientPreferencesSyncTest
, Sanity_E2ETest
) {
30 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
31 ASSERT_TRUE(AwaitStringPrefMatches(prefs::kHomePage
));
32 const std::string new_home_page
= base::StringPrintf(
33 "https://example.com/%s", base::GenerateGUID().c_str());
34 ChangeStringPref(0, prefs::kHomePage
, new_home_page
);
35 ASSERT_TRUE(AwaitStringPrefMatches(prefs::kHomePage
));
36 for (int i
= 0; i
< num_clients(); ++i
) {
37 ASSERT_EQ(new_home_page
, GetPrefs(i
)->GetString(prefs::kHomePage
));