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 "chrome/browser/sync/glue/theme_util.h" | 5 #include "chrome/browser/sync/glue/theme_util.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" | 10 #include "chrome/browser/sync/protocol/theme_specifics.pb.h" |
11 #include "chrome/browser/themes/theme_service.h" | 11 #include "chrome/browser/themes/theme_service.h" |
12 #include "chrome/browser/themes/theme_service_factory.h" | 12 #include "chrome/browser/themes/theme_service_factory.h" |
13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 15 #include "chrome/test/testing_browser_process_test.h" |
15 #include "chrome/test/testing_profile.h" | 16 #include "chrome/test/testing_profile.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 namespace browser_sync { | 20 namespace browser_sync { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 using ::testing::AnyNumber; | 24 using ::testing::AnyNumber; |
24 using ::testing::Return; | 25 using ::testing::Return; |
25 | 26 |
26 class MockThemeService : public ThemeService { | 27 class MockThemeService : public ThemeService { |
27 public: | 28 public: |
28 MOCK_METHOD0(SetNativeTheme, void()); | 29 MOCK_METHOD0(SetNativeTheme, void()); |
29 MOCK_METHOD0(UseDefaultTheme, void()); | 30 MOCK_METHOD0(UseDefaultTheme, void()); |
30 MOCK_CONST_METHOD0(GetThemeID, std::string()); | 31 MOCK_CONST_METHOD0(GetThemeID, std::string()); |
31 }; | 32 }; |
32 | 33 |
33 ProfileKeyedService* BuildMockThemeService(Profile* profile) { | 34 ProfileKeyedService* BuildMockThemeService(Profile* profile) { |
34 return new MockThemeService; | 35 return new MockThemeService; |
35 } | 36 } |
36 | 37 |
37 class ThemeUtilTest : public testing::Test { | 38 class ThemeUtilTest : public TestingBrowserProcessTest { |
38 protected: | 39 protected: |
39 MockThemeService* BuildForProfile(Profile* profile) { | 40 MockThemeService* BuildForProfile(Profile* profile) { |
40 return static_cast<MockThemeService*>( | 41 return static_cast<MockThemeService*>( |
41 ThemeServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 42 ThemeServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
42 profile, BuildMockThemeService)); | 43 profile, BuildMockThemeService)); |
43 } | 44 } |
44 }; | 45 }; |
45 | 46 |
46 scoped_refptr<Extension> MakeThemeExtension(const FilePath& extension_path, | 47 scoped_refptr<Extension> MakeThemeExtension(const FilePath& extension_path, |
47 const std::string& name, | 48 const std::string& name, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // TODO(akalin): Mock out call to GetPrefs() under TOOLKIT_USES_GTK. | 233 // TODO(akalin): Mock out call to GetPrefs() under TOOLKIT_USES_GTK. |
233 | 234 |
234 sync_pb::ThemeSpecifics theme_specifics; | 235 sync_pb::ThemeSpecifics theme_specifics; |
235 SetCurrentThemeFromThemeSpecificsIfNecessary(theme_specifics, | 236 SetCurrentThemeFromThemeSpecificsIfNecessary(theme_specifics, |
236 &profile); | 237 &profile); |
237 } | 238 } |
238 | 239 |
239 } // namespace | 240 } // namespace |
240 | 241 |
241 } // namespace browser_sync | 242 } // namespace browser_sync |
OLD | NEW |