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 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_THEMES_SYNC_TEST_H_ | 5 #ifndef CHROME_TEST_LIVE_SYNC_LIVE_THEMES_SYNC_TEST_H_ |
6 #define CHROME_TEST_LIVE_SYNC_LIVE_THEMES_SYNC_TEST_H_ | 6 #define CHROME_TEST_LIVE_SYNC_LIVE_THEMES_SYNC_TEST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "chrome/test/live_sync/live_sync_extension_helper.h" |
14 #include "base/memory/scoped_temp_dir.h" | 14 #include "chrome/test/live_sync/live_sync_test.h" |
15 #include "chrome/test/live_sync/live_extensions_sync_test_base.h" | |
16 | 15 |
17 class Extension; | |
18 class Profile; | 16 class Profile; |
19 | 17 |
20 class LiveThemesSyncTest : public LiveExtensionsSyncTestBase { | 18 class LiveThemesSyncTest : public LiveSyncTest { |
21 public: | 19 public: |
22 explicit LiveThemesSyncTest(TestType test_type); | 20 explicit LiveThemesSyncTest(TestType test_type); |
23 virtual ~LiveThemesSyncTest(); | 21 virtual ~LiveThemesSyncTest(); |
24 | 22 |
25 protected: | 23 protected: |
26 // Set the theme of the given profile to a custom theme from the | 24 // Like LiveSyncTest::SetupClients(), but also sets up |
27 // given theme extension. | 25 // |extension_helper_|. |
28 static void SetTheme(Profile* profile, scoped_refptr<Extension> theme); | 26 virtual bool SetupClients() OVERRIDE WARN_UNUSED_RESULT; |
29 | 27 |
30 // Sets |profile| so that it uses the native theme. | 28 // Gets the unique ID of the custom theme with the given index. |
31 void SetNativeTheme(Profile* profile); | 29 std::string GetCustomTheme(int index) const WARN_UNUSED_RESULT; |
32 | 30 |
33 // Sets |profile| to the default theme. | 31 // Gets the ID of |profile|'s theme. |
| 32 std::string GetThemeID(Profile* profile) const WARN_UNUSED_RESULT; |
| 33 |
| 34 // Returns true iff |profile| is using a custom theme. |
| 35 bool UsingCustomTheme(Profile* profile) const WARN_UNUSED_RESULT; |
| 36 |
| 37 // Returns true iff |profile| is using the default theme. |
| 38 bool UsingDefaultTheme(Profile* profile) const WARN_UNUSED_RESULT; |
| 39 |
| 40 // Returns true iff |profile| is using the native theme. |
| 41 bool UsingNativeTheme(Profile* profile) const WARN_UNUSED_RESULT; |
| 42 |
| 43 // Returns true iff a theme with the given ID is pending install in |
| 44 // |profile|. |
| 45 bool ThemeIsPendingInstall( |
| 46 Profile* profile, const std::string& id) const WARN_UNUSED_RESULT; |
| 47 |
| 48 // Returns true iff |profile|'s current theme is the given |
| 49 // custom theme or if the given theme is pending install. |
| 50 bool HasOrWillHaveCustomTheme( |
| 51 Profile* profile, const std::string& id) const WARN_UNUSED_RESULT; |
| 52 |
| 53 // Sets |profile| to use the custom theme with the given index. |
| 54 void UseCustomTheme(Profile* profile, int index); |
| 55 |
| 56 // Sets |profile| to use the default theme. |
34 void UseDefaultTheme(Profile* profile); | 57 void UseDefaultTheme(Profile* profile); |
35 | 58 |
36 // Gets the custom theme of the given profile, or NULL if the given | 59 // Sets |profile| to use the native theme. |
37 // profile doesn't have one. | 60 void UseNativeTheme(Profile* profile); |
38 const Extension* GetCustomTheme(Profile* profile) WARN_UNUSED_RESULT; | |
39 | |
40 // Returns true iff the given profile is using the default theme. | |
41 bool UsingDefaultTheme(Profile* profile) WARN_UNUSED_RESULT; | |
42 | |
43 // Returns true iff the given profile is using the native theme. On | |
44 // platforms where the native theme is just the default theme, this | |
45 // is equivalent to UsingDefaultTheme(). | |
46 bool UsingNativeTheme(Profile* profile) WARN_UNUSED_RESULT; | |
47 | |
48 // Returns true iff the given extension is pending install for the | |
49 // given profile. | |
50 bool ExtensionIsPendingInstall( | |
51 Profile* profile, const Extension* extension) WARN_UNUSED_RESULT; | |
52 | |
53 // Returns true iff the given profile's current theme is the given | |
54 // custom theme or if the given theme is pending install. | |
55 bool HasOrWillHaveCustomTheme(Profile* profile, | |
56 const Extension* theme) WARN_UNUSED_RESULT; | |
57 | 61 |
58 private: | 62 private: |
| 63 LiveSyncExtensionHelper extension_helper_; |
| 64 |
59 DISALLOW_COPY_AND_ASSIGN(LiveThemesSyncTest); | 65 DISALLOW_COPY_AND_ASSIGN(LiveThemesSyncTest); |
60 }; | 66 }; |
61 | 67 |
62 #endif // CHROME_TEST_LIVE_SYNC_LIVE_THEMES_SYNC_TEST_H_ | 68 #endif // CHROME_TEST_LIVE_SYNC_LIVE_THEMES_SYNC_TEST_H_ |
OLD | NEW |