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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/values.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/test_extension_system.h" | 18 #include "chrome/browser/extensions/test_extension_system.h" |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/themes/theme_service.h" | 20 #include "chrome/browser/themes/theme_service.h" |
20 #include "chrome/browser/themes/theme_service_factory.h" | 21 #include "chrome/browser/themes/theme_service_factory.h" |
21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
23 #include "components/sync/model/attachments/attachment_id.h" | 24 #include "components/sync/model/attachments/attachment_id.h" |
24 #include "components/sync/model/attachments/attachment_service_proxy_for_test.h" | 25 #include "components/sync/model/attachments/attachment_service_proxy_for_test.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 return base::WrapUnique(new FakeThemeService); | 134 return base::WrapUnique(new FakeThemeService); |
134 } | 135 } |
135 | 136 |
136 scoped_refptr<extensions::Extension> MakeThemeExtension( | 137 scoped_refptr<extensions::Extension> MakeThemeExtension( |
137 const base::FilePath& extension_path, | 138 const base::FilePath& extension_path, |
138 const string& name, | 139 const string& name, |
139 extensions::Manifest::Location location, | 140 extensions::Manifest::Location location, |
140 const string& update_url) { | 141 const string& update_url) { |
141 base::DictionaryValue source; | 142 base::DictionaryValue source; |
142 source.SetString(extensions::manifest_keys::kName, name); | 143 source.SetString(extensions::manifest_keys::kName, name); |
143 source.Set(extensions::manifest_keys::kTheme, new base::DictionaryValue()); | 144 source.Set(extensions::manifest_keys::kTheme, |
| 145 base::MakeUnique<base::DictionaryValue>()); |
144 source.SetString(extensions::manifest_keys::kUpdateURL, update_url); | 146 source.SetString(extensions::manifest_keys::kUpdateURL, update_url); |
145 source.SetString(extensions::manifest_keys::kVersion, "0.0.0.0"); | 147 source.SetString(extensions::manifest_keys::kVersion, "0.0.0.0"); |
146 string error; | 148 string error; |
147 scoped_refptr<extensions::Extension> extension = | 149 scoped_refptr<extensions::Extension> extension = |
148 extensions::Extension::Create( | 150 extensions::Extension::Create( |
149 extension_path, location, source, | 151 extension_path, location, source, |
150 extensions::Extension::NO_FLAGS, &error); | 152 extensions::Extension::NO_FLAGS, &error); |
151 EXPECT_TRUE(extension.get()); | 153 EXPECT_TRUE(extension.get()); |
152 EXPECT_EQ("", error); | 154 EXPECT_EQ("", error); |
153 return extension; | 155 return extension; |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 | 654 |
653 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) { | 655 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) { |
654 // Set up theme service to use custom theme that was installed by policy. | 656 // Set up theme service to use custom theme that was installed by policy. |
655 fake_theme_service_->SetTheme(theme_extension_.get()); | 657 fake_theme_service_->SetTheme(theme_extension_.get()); |
656 | 658 |
657 syncer::SyncDataList data_list = | 659 syncer::SyncDataList data_list = |
658 theme_sync_service_->GetAllSyncData(syncer::THEMES); | 660 theme_sync_service_->GetAllSyncData(syncer::THEMES); |
659 | 661 |
660 ASSERT_EQ(0u, data_list.size()); | 662 ASSERT_EQ(0u, data_list.size()); |
661 } | 663 } |
OLD | NEW |