OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/macros.h" | 5 #include "base/macros.h" |
6 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.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" | 7 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
8 #include "chrome/browser/sync/test/integration/sync_test.h" | 8 #include "chrome/browser/sync/test/integration/sync_test.h" |
9 #include "chrome/browser/sync/test/integration/themes_helper.h" | 9 #include "chrome/browser/sync/test/integration/themes_helper.h" |
10 | 10 |
11 using themes_helper::AwaitThemeIsPendingInstall; | |
12 using themes_helper::AwaitUsingSystemTheme; | |
13 using themes_helper::AwaitUsingDefaultTheme; | |
14 using themes_helper::GetCustomTheme; | 11 using themes_helper::GetCustomTheme; |
15 using themes_helper::GetThemeID; | 12 using themes_helper::GetThemeID; |
16 using themes_helper::UseCustomTheme; | 13 using themes_helper::UseCustomTheme; |
17 using themes_helper::UseDefaultTheme; | 14 using themes_helper::UseDefaultTheme; |
18 using themes_helper::UseSystemTheme; | 15 using themes_helper::UseSystemTheme; |
19 using themes_helper::UsingCustomTheme; | 16 using themes_helper::UsingCustomTheme; |
20 using themes_helper::UsingDefaultTheme; | 17 using themes_helper::UsingDefaultTheme; |
21 using themes_helper::UsingSystemTheme; | 18 using themes_helper::UsingSystemTheme; |
22 | 19 |
23 class TwoClientThemesSyncTest : public SyncTest { | 20 class TwoClientThemesSyncTest : public SyncTest { |
(...skipping 16 matching lines...) Expand all Loading... |
40 | 37 |
41 ASSERT_FALSE(UsingCustomTheme(GetProfile(0))); | 38 ASSERT_FALSE(UsingCustomTheme(GetProfile(0))); |
42 ASSERT_FALSE(UsingCustomTheme(GetProfile(1))); | 39 ASSERT_FALSE(UsingCustomTheme(GetProfile(1))); |
43 | 40 |
44 UseCustomTheme(GetProfile(0), 0); | 41 UseCustomTheme(GetProfile(0), 0); |
45 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); | 42 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
46 | 43 |
47 // TODO(sync): Add functions to simulate when a pending extension | 44 // TODO(sync): Add functions to simulate when a pending extension |
48 // is installed as well as when a pending extension fails to | 45 // is installed as well as when a pending extension fails to |
49 // install. | 46 // install. |
50 ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0))); | 47 ASSERT_TRUE( |
| 48 ThemePendingInstallChecker(GetProfile(1), GetCustomTheme(0)).Wait()); |
51 | 49 |
52 EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); | 50 EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
53 EXPECT_FALSE(UsingCustomTheme(GetProfile(1))); | 51 EXPECT_FALSE(UsingCustomTheme(GetProfile(1))); |
54 } | 52 } |
55 | 53 |
56 // Starts with custom themes, then sets up sync and uses it to set all profiles | 54 // Starts with custom themes, then sets up sync and uses it to set all profiles |
57 // to the system theme. | 55 // to the system theme. |
58 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, | 56 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, |
59 E2E_ENABLED(CustomThenSyncNative)) { | 57 E2E_ENABLED(CustomThenSyncNative)) { |
60 ASSERT_TRUE(SetupClients()); | 58 ASSERT_TRUE(SetupClients()); |
61 | 59 |
62 UseCustomTheme(GetProfile(0), 0); | 60 UseCustomTheme(GetProfile(0), 0); |
63 UseCustomTheme(GetProfile(1), 0); | 61 UseCustomTheme(GetProfile(1), 0); |
64 | 62 |
65 ASSERT_TRUE(SetupSync()); | 63 ASSERT_TRUE(SetupSync()); |
66 | 64 |
67 UseSystemTheme(GetProfile(0)); | 65 UseSystemTheme(GetProfile(0)); |
68 ASSERT_TRUE(UsingSystemTheme(GetProfile(0))); | 66 ASSERT_TRUE(UsingSystemTheme(GetProfile(0))); |
69 | 67 |
70 ASSERT_TRUE(AwaitUsingSystemTheme(GetProfile(1))); | 68 ASSERT_TRUE(SystemThemeChecker(GetProfile(1)).Wait()); |
71 | 69 |
72 EXPECT_TRUE(UsingSystemTheme(GetProfile(0))); | 70 EXPECT_TRUE(UsingSystemTheme(GetProfile(0))); |
73 EXPECT_TRUE(UsingSystemTheme(GetProfile(1))); | 71 EXPECT_TRUE(UsingSystemTheme(GetProfile(1))); |
74 } | 72 } |
75 | 73 |
76 // Starts with custom themes, then sets up sync and uses it to set all profiles | 74 // Starts with custom themes, then sets up sync and uses it to set all profiles |
77 // to the default theme. | 75 // to the default theme. |
78 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, | 76 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, |
79 E2E_ENABLED(CustomThenSyncDefault)) { | 77 E2E_ENABLED(CustomThenSyncDefault)) { |
80 ASSERT_TRUE(SetupClients()); | 78 ASSERT_TRUE(SetupClients()); |
81 | 79 |
82 UseCustomTheme(GetProfile(0), 0); | 80 UseCustomTheme(GetProfile(0), 0); |
83 UseCustomTheme(GetProfile(1), 0); | 81 UseCustomTheme(GetProfile(1), 0); |
84 | 82 |
85 ASSERT_TRUE(SetupSync()); | 83 ASSERT_TRUE(SetupSync()); |
86 | 84 |
87 UseDefaultTheme(GetProfile(0)); | 85 UseDefaultTheme(GetProfile(0)); |
88 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0))); | 86 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0))); |
89 | 87 |
90 ASSERT_TRUE(AwaitUsingDefaultTheme(GetProfile(1))); | 88 ASSERT_TRUE(DefaultThemeChecker(GetProfile(1)).Wait()); |
91 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0))); | 89 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0))); |
92 EXPECT_TRUE(UsingDefaultTheme(GetProfile(1))); | 90 EXPECT_TRUE(UsingDefaultTheme(GetProfile(1))); |
93 } | 91 } |
94 | 92 |
95 // Cycles through a set of options. | 93 // Cycles through a set of options. |
96 // | 94 // |
97 // Most other tests have significant coverage of model association. This test | 95 // Most other tests have significant coverage of model association. This test |
98 // is intended to test steady-state scenarios. | 96 // is intended to test steady-state scenarios. |
99 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, E2E_ENABLED(CycleOptions)) { | 97 IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, E2E_ENABLED(CycleOptions)) { |
100 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 98 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
101 | 99 |
102 UseCustomTheme(GetProfile(0), 0); | 100 UseCustomTheme(GetProfile(0), 0); |
103 | 101 |
104 ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(0))); | 102 ASSERT_TRUE( |
| 103 ThemePendingInstallChecker(GetProfile(1), GetCustomTheme(0)).Wait()); |
105 EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); | 104 EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
106 | 105 |
107 UseSystemTheme(GetProfile(0)); | 106 UseSystemTheme(GetProfile(0)); |
108 | 107 |
109 ASSERT_TRUE(AwaitUsingSystemTheme(GetProfile(1))); | 108 ASSERT_TRUE(SystemThemeChecker(GetProfile(1)).Wait()); |
110 EXPECT_TRUE(UsingSystemTheme(GetProfile(0))); | 109 EXPECT_TRUE(UsingSystemTheme(GetProfile(0))); |
111 EXPECT_TRUE(UsingSystemTheme(GetProfile(1))); | 110 EXPECT_TRUE(UsingSystemTheme(GetProfile(1))); |
112 | 111 |
113 UseDefaultTheme(GetProfile(0)); | 112 UseDefaultTheme(GetProfile(0)); |
114 | 113 |
115 ASSERT_TRUE(AwaitUsingDefaultTheme(GetProfile(1))); | 114 ASSERT_TRUE(DefaultThemeChecker(GetProfile(1)).Wait()); |
116 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0))); | 115 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0))); |
117 EXPECT_TRUE(UsingDefaultTheme(GetProfile(1))); | 116 EXPECT_TRUE(UsingDefaultTheme(GetProfile(1))); |
118 | 117 |
119 UseCustomTheme(GetProfile(0), 1); | 118 UseCustomTheme(GetProfile(0), 1); |
120 ASSERT_TRUE(AwaitThemeIsPendingInstall(GetProfile(1), GetCustomTheme(1))); | 119 ASSERT_TRUE( |
| 120 ThemePendingInstallChecker(GetProfile(1), GetCustomTheme(1)).Wait()); |
121 EXPECT_EQ(GetCustomTheme(1), GetThemeID(GetProfile(0))); | 121 EXPECT_EQ(GetCustomTheme(1), GetThemeID(GetProfile(0))); |
122 } | 122 } |
OLD | NEW |