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