OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> |
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/scoped_temp_dir.h" | 13 #include "base/scoped_temp_dir.h" |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
15 #include "chrome/test/live_sync/live_sync_test.h" | 15 #include "chrome/test/live_sync/live_extensions_sync_test_base.h" |
16 | 16 |
17 class Extension; | 17 class Extension; |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 class LiveThemesSyncTest : public LiveSyncTest { | 20 class LiveThemesSyncTest : public LiveExtensionsSyncTestBase { |
21 public: | 21 public: |
22 explicit LiveThemesSyncTest(TestType test_type); | 22 explicit LiveThemesSyncTest(TestType test_type); |
23 virtual ~LiveThemesSyncTest(); | 23 virtual ~LiveThemesSyncTest(); |
24 | 24 |
25 // Like LiveSyncTest::SetupClients(), but also initializes | |
26 // extensions for each profile and also creates n themes (n = | |
27 // num_clients()). | |
28 virtual bool SetupClients() WARN_UNUSED_RESULT; | |
29 | |
30 protected: | 25 protected: |
31 // Get the index'th theme created by SetupClients(). | |
32 scoped_refptr<Extension> GetTheme(int index) WARN_UNUSED_RESULT; | |
33 | |
34 // Set the theme of the given profile to a custom theme from the | 26 // Set the theme of the given profile to a custom theme from the |
35 // given theme extension. | 27 // given theme extension. |
36 static void SetTheme(Profile* profile, scoped_refptr<Extension> theme); | 28 static void SetTheme(Profile* profile, scoped_refptr<Extension> theme); |
37 | 29 |
38 // Gets the custom theme of the given profile, or NULL if the given | 30 // Gets the custom theme of the given profile, or NULL if the given |
39 // profile doesn't have one. | 31 // profile doesn't have one. |
40 const Extension* GetCustomTheme(Profile* profile) WARN_UNUSED_RESULT; | 32 const Extension* GetCustomTheme(Profile* profile) WARN_UNUSED_RESULT; |
41 | 33 |
42 // Returns true iff the given profile is using the default theme. | 34 // Returns true iff the given profile is using the default theme. |
43 bool UsingDefaultTheme(Profile* profile) WARN_UNUSED_RESULT; | 35 bool UsingDefaultTheme(Profile* profile) WARN_UNUSED_RESULT; |
44 | 36 |
45 // Returns true iff the given profile is using the native theme. On | 37 // Returns true iff the given profile is using the native theme. On |
46 // platforms where the native theme is just the default theme, this | 38 // platforms where the native theme is just the default theme, this |
47 // is equivalent to UsingDefaultTheme(). | 39 // is equivalent to UsingDefaultTheme(). |
48 bool UsingNativeTheme(Profile* profile) WARN_UNUSED_RESULT; | 40 bool UsingNativeTheme(Profile* profile) WARN_UNUSED_RESULT; |
49 | 41 |
50 // Returns true iff the given extension is pending install for the | 42 // Returns true iff the given extension is pending install for the |
51 // given profile. | 43 // given profile. |
52 bool ExtensionIsPendingInstall( | 44 bool ExtensionIsPendingInstall( |
53 Profile* profile, const Extension* extension) WARN_UNUSED_RESULT; | 45 Profile* profile, const Extension* extension) WARN_UNUSED_RESULT; |
54 | 46 |
55 // Returns true iff the given profile's current theme is the given | 47 // Returns true iff the given profile's current theme is the given |
56 // custom theme or if the given theme is pending install. | 48 // custom theme or if the given theme is pending install. |
57 bool HasOrWillHaveCustomTheme(Profile* profile, | 49 bool HasOrWillHaveCustomTheme(Profile* profile, |
58 const Extension* theme) WARN_UNUSED_RESULT; | 50 const Extension* theme) WARN_UNUSED_RESULT; |
59 | 51 |
60 private: | 52 private: |
61 ScopedTempDir theme_dir_; | |
62 std::vector<scoped_refptr<Extension> > themes_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(LiveThemesSyncTest); | 53 DISALLOW_COPY_AND_ASSIGN(LiveThemesSyncTest); |
65 }; | 54 }; |
66 | 55 |
67 #endif // CHROME_TEST_LIVE_SYNC_LIVE_THEMES_SYNC_TEST_H_ | 56 #endif // CHROME_TEST_LIVE_SYNC_LIVE_THEMES_SYNC_TEST_H_ |
OLD | NEW |