OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" |
7 #include "chrome/browser/sync/test/integration/sync_test.h" | 9 #include "chrome/browser/sync/test/integration/sync_test.h" |
8 #include "chrome/browser/sync/test/integration/themes_helper.h" | 10 #include "chrome/browser/sync/test/integration/themes_helper.h" |
9 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" | 11 #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h
" |
| 12 #include "chrome/browser/themes/theme_service_factory.h" |
10 #include "components/browser_sync/profile_sync_service.h" | 13 #include "components/browser_sync/profile_sync_service.h" |
| 14 #include "content/public/test/test_utils.h" |
11 | 15 |
12 using themes_helper::GetCustomTheme; | 16 using themes_helper::GetCustomTheme; |
13 using themes_helper::GetThemeID; | 17 using themes_helper::GetThemeID; |
14 using themes_helper::UseCustomTheme; | |
15 using themes_helper::UseDefaultTheme; | 18 using themes_helper::UseDefaultTheme; |
16 using themes_helper::UseSystemTheme; | 19 using themes_helper::UseSystemTheme; |
17 using themes_helper::UsingCustomTheme; | 20 using themes_helper::UsingCustomTheme; |
18 using themes_helper::UsingDefaultTheme; | 21 using themes_helper::UsingDefaultTheme; |
19 using themes_helper::UsingSystemTheme; | 22 using themes_helper::UsingSystemTheme; |
20 | 23 |
| 24 namespace { |
| 25 |
21 class SingleClientThemesSyncTest : public SyncTest { | 26 class SingleClientThemesSyncTest : public SyncTest { |
22 public: | 27 public: |
23 SingleClientThemesSyncTest() : SyncTest(SINGLE_CLIENT) {} | 28 SingleClientThemesSyncTest() : SyncTest(SINGLE_CLIENT) {} |
24 ~SingleClientThemesSyncTest() override {} | 29 ~SingleClientThemesSyncTest() override {} |
25 | 30 |
26 private: | 31 private: |
27 DISALLOW_COPY_AND_ASSIGN(SingleClientThemesSyncTest); | 32 DISALLOW_COPY_AND_ASSIGN(SingleClientThemesSyncTest); |
28 }; | 33 }; |
29 | 34 |
30 // TODO(akalin): Add tests for model association (i.e., tests that | 35 // TODO(akalin): Add tests for model association (i.e., tests that |
31 // start with SetupClients(), change the theme state, then call | 36 // start with SetupClients(), change the theme state, then call |
32 // SetupSync()). | 37 // SetupSync()). |
33 | 38 |
34 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, CustomTheme) { | 39 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, CustomTheme) { |
35 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 40 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
36 | 41 |
37 ASSERT_FALSE(UsingCustomTheme(GetProfile(0))); | 42 EXPECT_FALSE(UsingCustomTheme(GetProfile(0))); |
38 ASSERT_FALSE(UsingCustomTheme(verifier())); | 43 EXPECT_FALSE(UsingCustomTheme(verifier())); |
39 | 44 |
40 UseCustomTheme(GetProfile(0), 0); | 45 SetCustomTheme(GetProfile(0)); |
41 UseCustomTheme(verifier(), 0); | 46 SetCustomTheme(verifier()); |
42 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); | 47 EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
43 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier())); | 48 EXPECT_EQ(GetCustomTheme(0), GetThemeID(verifier())); |
44 | 49 |
45 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); | 50 EXPECT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); |
46 | 51 |
47 ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); | 52 EXPECT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0))); |
48 ASSERT_EQ(GetCustomTheme(0), GetThemeID(verifier())); | 53 EXPECT_EQ(GetCustomTheme(0), GetThemeID(verifier())); |
49 } | 54 } |
50 | 55 |
51 // TODO(sync): Fails on Chrome OS. See http://crbug.com/84575. | 56 // TODO(sync): Fails on Chrome OS. See http://crbug.com/84575. |
52 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
53 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, DISABLED_NativeTheme) { | 58 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, DISABLED_NativeTheme) { |
54 #else | 59 #else |
55 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, NativeTheme) { | 60 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, NativeTheme) { |
56 #endif // OS_CHROMEOS | 61 #endif // OS_CHROMEOS |
57 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 62 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
58 | 63 |
59 UseCustomTheme(GetProfile(0), 0); | 64 SetCustomTheme(GetProfile(0)); |
60 UseCustomTheme(verifier(), 0); | 65 SetCustomTheme(verifier()); |
61 ASSERT_FALSE(UsingSystemTheme(GetProfile(0))); | 66 EXPECT_FALSE(UsingSystemTheme(GetProfile(0))); |
62 ASSERT_FALSE(UsingSystemTheme(verifier())); | 67 EXPECT_FALSE(UsingSystemTheme(verifier())); |
63 | 68 |
64 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); | 69 EXPECT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); |
65 | 70 |
66 UseSystemTheme(GetProfile(0)); | 71 UseSystemTheme(GetProfile(0)); |
67 UseSystemTheme(verifier()); | 72 UseSystemTheme(verifier()); |
68 ASSERT_TRUE(UsingSystemTheme(GetProfile(0))); | 73 EXPECT_TRUE(UsingSystemTheme(GetProfile(0))); |
69 ASSERT_TRUE(UsingSystemTheme(verifier())); | 74 EXPECT_TRUE(UsingSystemTheme(verifier())); |
70 | 75 |
71 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); | 76 EXPECT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); |
72 | 77 |
73 ASSERT_TRUE(UsingSystemTheme(GetProfile(0))); | 78 EXPECT_TRUE(UsingSystemTheme(GetProfile(0))); |
74 ASSERT_TRUE(UsingSystemTheme(verifier())); | 79 EXPECT_TRUE(UsingSystemTheme(verifier())); |
75 } | 80 } |
76 | 81 |
77 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, DefaultTheme) { | 82 IN_PROC_BROWSER_TEST_F(SingleClientThemesSyncTest, DefaultTheme) { |
78 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 83 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
79 | 84 |
80 UseCustomTheme(GetProfile(0), 0); | 85 SetCustomTheme(GetProfile(0)); |
81 UseCustomTheme(verifier(), 0); | 86 EXPECT_FALSE(UsingDefaultTheme(GetProfile(0))); |
82 ASSERT_FALSE(UsingDefaultTheme(GetProfile(0))); | |
83 ASSERT_FALSE(UsingDefaultTheme(verifier())); | |
84 | 87 |
85 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); | 88 SetCustomTheme(verifier()); |
| 89 EXPECT_FALSE(UsingDefaultTheme(verifier())); |
86 | 90 |
| 91 EXPECT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); |
87 UseDefaultTheme(GetProfile(0)); | 92 UseDefaultTheme(GetProfile(0)); |
| 93 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0))); |
88 UseDefaultTheme(verifier()); | 94 UseDefaultTheme(verifier()); |
89 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); | 95 EXPECT_TRUE(UsingDefaultTheme(verifier())); |
90 ASSERT_TRUE(UsingDefaultTheme(verifier())); | |
91 | 96 |
92 ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); | 97 EXPECT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); |
93 | 98 |
94 ASSERT_TRUE(UsingDefaultTheme(GetProfile(0))); | 99 EXPECT_TRUE(UsingDefaultTheme(GetProfile(0))); |
95 ASSERT_TRUE(UsingDefaultTheme(verifier())); | 100 EXPECT_TRUE(UsingDefaultTheme(verifier())); |
96 } | 101 } |
| 102 |
| 103 } // namespace |
OLD | NEW |