| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/themes/theme_syncable_service.h" | 5 #include "chrome/browser/themes/theme_syncable_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/test_extension_system.h" | 13 #include "chrome/browser/extensions/test_extension_system.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/themes/theme_service.h" | 15 #include "chrome/browser/themes/theme_service.h" |
| 16 #include "chrome/browser/themes/theme_service_factory.h" | 16 #include "chrome/browser/themes/theme_service_factory.h" |
| 17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 19 #include "chrome/common/extensions/extension_messages.h" | 18 #include "chrome/common/extensions/extension_messages.h" |
| 20 #include "chrome/common/extensions/manifest_url_handler.h" | 19 #include "chrome/common/extensions/manifest_url_handler.h" |
| 21 #include "chrome/common/extensions/permissions/api_permission_set.h" | 20 #include "chrome/common/extensions/permissions/api_permission_set.h" |
| 22 #include "chrome/common/extensions/permissions/permission_set.h" | 21 #include "chrome/common/extensions/permissions/permission_set.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
| 24 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
| 24 #include "extensions/common/manifest_constants.h" |
| 25 #include "sync/api/sync_error.h" | 25 #include "sync/api/sync_error.h" |
| 26 #include "sync/api/sync_error_factory_mock.h" | 26 #include "sync/api/sync_error_factory_mock.h" |
| 27 #include "sync/protocol/sync.pb.h" | 27 #include "sync/protocol/sync.pb.h" |
| 28 #include "sync/protocol/theme_specifics.pb.h" | 28 #include "sync/protocol/theme_specifics.pb.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 30 |
| 31 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 32 #include "chrome/browser/chromeos/login/user_manager.h" | 32 #include "chrome/browser/chromeos/login/user_manager.h" |
| 33 #include "chrome/browser/chromeos/settings/cros_settings.h" | 33 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 34 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 34 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 content::BrowserContext* profile) { | 137 content::BrowserContext* profile) { |
| 138 return new FakeThemeService; | 138 return new FakeThemeService; |
| 139 } | 139 } |
| 140 | 140 |
| 141 scoped_refptr<extensions::Extension> MakeThemeExtension( | 141 scoped_refptr<extensions::Extension> MakeThemeExtension( |
| 142 const base::FilePath& extension_path, | 142 const base::FilePath& extension_path, |
| 143 const string& name, | 143 const string& name, |
| 144 extensions::Manifest::Location location, | 144 extensions::Manifest::Location location, |
| 145 const string& update_url) { | 145 const string& update_url) { |
| 146 DictionaryValue source; | 146 DictionaryValue source; |
| 147 source.SetString(extension_manifest_keys::kName, name); | 147 source.SetString(extensions::manifest_keys::kName, name); |
| 148 source.Set(extension_manifest_keys::kTheme, new DictionaryValue()); | 148 source.Set(extensions::manifest_keys::kTheme, new DictionaryValue()); |
| 149 source.SetString(extension_manifest_keys::kUpdateURL, update_url); | 149 source.SetString(extensions::manifest_keys::kUpdateURL, update_url); |
| 150 source.SetString(extension_manifest_keys::kVersion, "0.0.0.0"); | 150 source.SetString(extensions::manifest_keys::kVersion, "0.0.0.0"); |
| 151 string error; | 151 string error; |
| 152 scoped_refptr<extensions::Extension> extension = | 152 scoped_refptr<extensions::Extension> extension = |
| 153 extensions::Extension::Create( | 153 extensions::Extension::Create( |
| 154 extension_path, location, source, | 154 extension_path, location, source, |
| 155 extensions::Extension::NO_FLAGS, &error); | 155 extensions::Extension::NO_FLAGS, &error); |
| 156 EXPECT_TRUE(extension.get()); | 156 EXPECT_TRUE(extension.get()); |
| 157 EXPECT_EQ("", error); | 157 EXPECT_EQ("", error); |
| 158 return extension; | 158 return extension; |
| 159 } | 159 } |
| 160 | 160 |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 614 |
| 615 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) { | 615 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) { |
| 616 // Set up theme service to use custom theme that was installed by policy. | 616 // Set up theme service to use custom theme that was installed by policy. |
| 617 fake_theme_service_->SetTheme(theme_extension_.get()); | 617 fake_theme_service_->SetTheme(theme_extension_.get()); |
| 618 | 618 |
| 619 syncer::SyncDataList data_list = | 619 syncer::SyncDataList data_list = |
| 620 theme_sync_service_->GetAllSyncData(syncer::THEMES); | 620 theme_sync_service_->GetAllSyncData(syncer::THEMES); |
| 621 | 621 |
| 622 ASSERT_EQ(0u, data_list.size()); | 622 ASSERT_EQ(0u, data_list.size()); |
| 623 } | 623 } |
| OLD | NEW |