Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / sync / test / integration / two_client_themes_sync_test.cc
blob26e64a7ea0f8dece31a11fef81a215d4509e9b93
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
3 // found in the LICENSE file.
5 #include "base/basictypes.h"
6 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
7 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
8 #include "chrome/browser/sync/test/integration/sync_test.h"
9 #include "chrome/browser/sync/test/integration/themes_helper.h"
11 using themes_helper::AwaitThemeIsPendingInstall;
12 using themes_helper::AwaitUsingSystemTheme;
13 using themes_helper::AwaitUsingDefaultTheme;
14 using themes_helper::GetCustomTheme;
15 using themes_helper::GetThemeID;
16 using themes_helper::UseCustomTheme;
17 using themes_helper::UseDefaultTheme;
18 using themes_helper::UseSystemTheme;
19 using themes_helper::UsingCustomTheme;
20 using themes_helper::UsingDefaultTheme;
21 using themes_helper::UsingSystemTheme;
23 class TwoClientThemesSyncTest : public SyncTest {
24 public:
25 TwoClientThemesSyncTest() : SyncTest(TWO_CLIENT) {}
26 ~TwoClientThemesSyncTest() override {}
28 bool TestUsesSelfNotifications() override { return false; }
30 private:
31 DISALLOW_COPY_AND_ASSIGN(TwoClientThemesSyncTest);
34 // Starts with default themes, then sets up sync and uses it to set all
35 // profiles to use a custom theme. Does not actually install any themes, but
36 // instead verifies the custom theme is pending for install.
37 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DefaultThenSyncCustom) {
38 ASSERT_TRUE(SetupSync());
40 ASSERT_FALSE(UsingCustomTheme(GetProfile(0)));
41 ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
42 ASSERT_FALSE(UsingCustomTheme(verifier()));
44 UseCustomTheme(GetProfile(0), 0);
45 UseCustomTheme(verifier(), 0);
46 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
47 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
49 // TODO(sync): Add functions to simulate when a pending extension
50 // is installed as well as when a pending extension fails to
51 // install.
52 ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
54 EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
55 EXPECT_FALSE(UsingCustomTheme(GetProfile(1)));
56 EXPECT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
59 // Starts with custom themes, then sets up sync and uses it to set all profiles
60 // to the system theme.
61 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomThenSyncNative) {
62 ASSERT_TRUE(SetupClients());
64 UseCustomTheme(GetProfile(0), 0);
65 UseCustomTheme(GetProfile(1), 0);
66 UseCustomTheme(verifier(), 0);
68 ASSERT_TRUE(SetupSync());
70 UseSystemTheme(GetProfile(0));
71 UseSystemTheme(verifier());
72 ASSERT_TRUE(UsingSystemTheme(GetProfile(0)));
73 ASSERT_TRUE(UsingSystemTheme(verifier()));
75 ASSERT_TRUE(AwaitUsingSystemTheme(GetProfile(1)));
77 EXPECT_TRUE(UsingSystemTheme(GetProfile(0)));
78 EXPECT_TRUE(UsingSystemTheme(GetProfile(1)));
79 EXPECT_TRUE(UsingSystemTheme(verifier()));
82 // Starts with custom themes, then sets up sync and uses it to set all profiles
83 // to the default theme.
84 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CustomThenSyncDefault) {
85 ASSERT_TRUE(SetupClients());
87 UseCustomTheme(GetProfile(0), 0);
88 UseCustomTheme(GetProfile(1), 0);
89 UseCustomTheme(verifier(), 0);
91 ASSERT_TRUE(SetupSync());
93 UseDefaultTheme(GetProfile(0));
94 UseDefaultTheme(verifier());
95 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0)));
96 EXPECT_TRUE(UsingDefaultTheme(verifier()));
98 ASSERT_TRUE(AwaitUsingDefaultTheme(GetProfile(1)));
99 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0)));
100 EXPECT_TRUE(UsingDefaultTheme(GetProfile(1)));
101 EXPECT_TRUE(UsingDefaultTheme(verifier()));
104 // Cycles through a set of options.
106 // Most other tests have significant coverage of model association. This test
107 // is intended to test steady-state scenarios.
108 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, CycleOptions) {
109 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
111 UseCustomTheme(GetProfile(0), 0);
112 UseCustomTheme(verifier(), 0);
114 ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0)));
115 EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
116 EXPECT_EQ(GetCustomTheme(0), GetThemeID(verifier()));
118 UseSystemTheme(GetProfile(0));
119 UseSystemTheme(verifier());
121 ASSERT_TRUE(AwaitUsingSystemTheme(GetProfile(1)));
122 EXPECT_TRUE(UsingSystemTheme(GetProfile(0)));
123 EXPECT_TRUE(UsingSystemTheme(GetProfile(1)));
124 EXPECT_TRUE(UsingSystemTheme(verifier()));
126 UseDefaultTheme(GetProfile(0));
127 UseDefaultTheme(verifier());
129 ASSERT_TRUE(AwaitUsingDefaultTheme(GetProfile(1)));
130 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0)));
131 EXPECT_TRUE(UsingDefaultTheme(GetProfile(1)));
132 EXPECT_TRUE(UsingDefaultTheme(verifier()));
134 UseCustomTheme(GetProfile(0), 1);
135 UseCustomTheme(verifier(), 1);
136 ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(1)));
137 EXPECT_EQ(GetCustomTheme(1), GetThemeID(GetProfile(0)));
138 EXPECT_EQ(GetCustomTheme(1), GetThemeID(verifier()));