Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: chrome/browser/themes/theme_syncable_service_unittest.cc

Issue 2799883003: Switch from TestBrowserThread to TestBrowserThreadBundle in chrome. (Closed)
Patch Set: fix-string Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
22 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
23 #include "components/sync/model/attachments/attachment_id.h" 23 #include "components/sync/model/attachments/attachment_id.h"
24 #include "components/sync/model/attachments/attachment_service_proxy_for_test.h" 24 #include "components/sync/model/attachments/attachment_service_proxy_for_test.h"
25 #include "components/sync/model/fake_sync_change_processor.h" 25 #include "components/sync/model/fake_sync_change_processor.h"
26 #include "components/sync/model/sync_change_processor_wrapper_for_test.h" 26 #include "components/sync/model/sync_change_processor_wrapper_for_test.h"
27 #include "components/sync/model/sync_error.h" 27 #include "components/sync/model/sync_error.h"
28 #include "components/sync/model/sync_error_factory_mock.h" 28 #include "components/sync/model/sync_error_factory_mock.h"
29 #include "components/sync/protocol/sync.pb.h" 29 #include "components/sync/protocol/sync.pb.h"
30 #include "components/sync/protocol/theme_specifics.pb.h" 30 #include "components/sync/protocol/theme_specifics.pb.h"
31 #include "content/public/test/test_browser_thread.h" 31 #include "content/public/test/test_browser_thread_bundle.h"
32 #include "extensions/browser/extension_prefs.h" 32 #include "extensions/browser/extension_prefs.h"
33 #include "extensions/browser/extension_registry.h" 33 #include "extensions/browser/extension_registry.h"
34 #include "extensions/common/extension.h" 34 #include "extensions/common/extension.h"
35 #include "extensions/common/manifest_constants.h" 35 #include "extensions/common/manifest_constants.h"
36 #include "extensions/common/manifest_url_handlers.h" 36 #include "extensions/common/manifest_url_handlers.h"
37 #include "extensions/common/permissions/api_permission_set.h" 37 #include "extensions/common/permissions/api_permission_set.h"
38 #include "extensions/common/permissions/permission_set.h" 38 #include "extensions/common/permissions/permission_set.h"
39 #include "testing/gtest/include/gtest/gtest.h" 39 #include "testing/gtest/include/gtest/gtest.h"
40 40
41 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 extensions::Extension::NO_FLAGS, &error); 150 extensions::Extension::NO_FLAGS, &error);
151 EXPECT_TRUE(extension.get()); 151 EXPECT_TRUE(extension.get());
152 EXPECT_EQ("", error); 152 EXPECT_EQ("", error);
153 return extension; 153 return extension;
154 } 154 }
155 155
156 } // namespace 156 } // namespace
157 157
158 class ThemeSyncableServiceTest : public testing::Test { 158 class ThemeSyncableServiceTest : public testing::Test {
159 protected: 159 protected:
160 ThemeSyncableServiceTest() 160 ThemeSyncableServiceTest() : fake_theme_service_(NULL) {}
161 : ui_thread_(content::BrowserThread::UI, &loop_),
162 file_thread_(content::BrowserThread::FILE, &loop_),
163 fake_theme_service_(NULL) {}
164 161
165 ~ThemeSyncableServiceTest() override {} 162 ~ThemeSyncableServiceTest() override {}
166 163
167 void SetUp() override { 164 void SetUp() override {
168 // Setting a matching update URL is necessary to make the test theme 165 // Setting a matching update URL is necessary to make the test theme
169 // considered syncable. 166 // considered syncable.
170 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 167 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
171 switches::kAppsGalleryUpdateURL, kCustomThemeUrl); 168 switches::kAppsGalleryUpdateURL, kCustomThemeUrl);
172 169
173 profile_.reset(new TestingProfile); 170 profile_.reset(new TestingProfile);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 sync_pb::EntitySpecifics entity_specifics; 223 sync_pb::EntitySpecifics entity_specifics;
227 entity_specifics.mutable_theme()->CopyFrom(theme_specifics); 224 entity_specifics.mutable_theme()->CopyFrom(theme_specifics);
228 list.push_back(syncer::SyncData::CreateLocalData( 225 list.push_back(syncer::SyncData::CreateLocalData(
229 ThemeSyncableService::kCurrentThemeClientTag, 226 ThemeSyncableService::kCurrentThemeClientTag,
230 ThemeSyncableService::kCurrentThemeNodeTitle, 227 ThemeSyncableService::kCurrentThemeNodeTitle,
231 entity_specifics)); 228 entity_specifics));
232 return list; 229 return list;
233 } 230 }
234 231
235 // Needed for setting up extension service. 232 // Needed for setting up extension service.
236 base::MessageLoop loop_; 233 content::TestBrowserThreadBundle test_browser_thread_bundle_;
237 content::TestBrowserThread ui_thread_;
238 content::TestBrowserThread file_thread_;
239 234
240 #if defined OS_CHROMEOS 235 #if defined OS_CHROMEOS
241 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 236 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
242 chromeos::ScopedTestCrosSettings test_cros_settings_; 237 chromeos::ScopedTestCrosSettings test_cros_settings_;
243 chromeos::ScopedTestUserManager test_user_manager_; 238 chromeos::ScopedTestUserManager test_user_manager_;
244 #endif 239 #endif
245 240
246 std::unique_ptr<TestingProfile> profile_; 241 std::unique_ptr<TestingProfile> profile_;
247 FakeThemeService* fake_theme_service_; 242 FakeThemeService* fake_theme_service_;
248 scoped_refptr<extensions::Extension> theme_extension_; 243 scoped_refptr<extensions::Extension> theme_extension_;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 652
658 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) { 653 TEST_F(PolicyInstalledThemeTest, InstallThemeByPolicy) {
659 // Set up theme service to use custom theme that was installed by policy. 654 // Set up theme service to use custom theme that was installed by policy.
660 fake_theme_service_->SetTheme(theme_extension_.get()); 655 fake_theme_service_->SetTheme(theme_extension_.get());
661 656
662 syncer::SyncDataList data_list = 657 syncer::SyncDataList data_list =
663 theme_sync_service_->GetAllSyncData(syncer::THEMES); 658 theme_sync_service_->GetAllSyncData(syncer::THEMES);
664 659
665 ASSERT_EQ(0u, data_list.size()); 660 ASSERT_EQ(0u, data_list.size());
666 } 661 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698