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

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 2919933002: Revert of ChromeOS: Per-user time zone: refactor tests first. (Closed)
Patch Set: Created 3 years, 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 #include "ppapi/features/features.h" 139 #include "ppapi/features/features.h"
140 #include "storage/browser/database/database_tracker.h" 140 #include "storage/browser/database/database_tracker.h"
141 #include "storage/browser/quota/quota_manager.h" 141 #include "storage/browser/quota/quota_manager.h"
142 #include "storage/common/database/database_identifier.h" 142 #include "storage/common/database/database_identifier.h"
143 #include "testing/gmock/include/gmock/gmock.h" 143 #include "testing/gmock/include/gmock/gmock.h"
144 #include "testing/gtest/include/gtest/gtest.h" 144 #include "testing/gtest/include/gtest/gtest.h"
145 #include "testing/platform_test.h" 145 #include "testing/platform_test.h"
146 #include "ui/base/l10n/l10n_util.h" 146 #include "ui/base/l10n/l10n_util.h"
147 #include "url/gurl.h" 147 #include "url/gurl.h"
148 148
149 #if defined(OS_CHROMEOS)
150 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h"
151 #include "chrome/browser/chromeos/settings/cros_settings.h"
152 #include "chrome/browser/chromeos/settings/device_settings_service.h"
153 #endif
154
149 // The blacklist tests rely on the safe-browsing database. 155 // The blacklist tests rely on the safe-browsing database.
150 #if defined(SAFE_BROWSING_DB_LOCAL) 156 #if defined(SAFE_BROWSING_DB_LOCAL)
151 #define ENABLE_BLACKLIST_TESTS 157 #define ENABLE_BLACKLIST_TESTS
152 #endif 158 #endif
153 159
154 using content::BrowserContext; 160 using content::BrowserContext;
155 using content::BrowserThread; 161 using content::BrowserThread;
156 using content::DOMStorageContext; 162 using content::DOMStorageContext;
157 using content::IndexedDBContext; 163 using content::IndexedDBContext;
158 using content::PluginService; 164 using content::PluginService;
(...skipping 5392 matching lines...) Expand 10 before | Expand all | Expand 10 after
5551 TEST_F(ExtensionServiceTestSimple, Enabledness) { 5557 TEST_F(ExtensionServiceTestSimple, Enabledness) {
5552 // Make sure the PluginService singleton is destroyed at the end of the test. 5558 // Make sure the PluginService singleton is destroyed at the end of the test.
5553 base::ShadowingAtExitManager at_exit_manager; 5559 base::ShadowingAtExitManager at_exit_manager;
5554 #if BUILDFLAG(ENABLE_PLUGINS) 5560 #if BUILDFLAG(ENABLE_PLUGINS)
5555 content::PluginService::GetInstance()->Init(); 5561 content::PluginService::GetInstance()->Init();
5556 #endif 5562 #endif
5557 5563
5558 ExtensionErrorReporter::Init(false); // no noisy errors 5564 ExtensionErrorReporter::Init(false); // no noisy errors
5559 ExtensionsReadyRecorder recorder; 5565 ExtensionsReadyRecorder recorder;
5560 std::unique_ptr<TestingProfile> profile(new TestingProfile()); 5566 std::unique_ptr<TestingProfile> profile(new TestingProfile());
5567 #if defined OS_CHROMEOS
5568 chromeos::ScopedTestDeviceSettingsService device_settings_service;
5569 chromeos::ScopedTestCrosSettings cros_settings;
5570 std::unique_ptr<chromeos::ScopedTestUserManager> user_manager(
5571 new chromeos::ScopedTestUserManager);
5572 #endif
5561 std::unique_ptr<base::CommandLine> command_line; 5573 std::unique_ptr<base::CommandLine> command_line;
5562 base::FilePath install_dir = profile->GetPath() 5574 base::FilePath install_dir = profile->GetPath()
5563 .AppendASCII(extensions::kInstallDirectoryName); 5575 .AppendASCII(extensions::kInstallDirectoryName);
5564 5576
5565 // By default, we are enabled. 5577 // By default, we are enabled.
5566 command_line.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM)); 5578 command_line.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM));
5567 ExtensionService* service = static_cast<extensions::TestExtensionSystem*>( 5579 ExtensionService* service = static_cast<extensions::TestExtensionSystem*>(
5568 ExtensionSystem::Get(profile.get()))-> 5580 ExtensionSystem::Get(profile.get()))->
5569 CreateExtensionService( 5581 CreateExtensionService(
5570 command_line.get(), 5582 command_line.get(),
5571 install_dir, 5583 install_dir,
5572 false); 5584 false);
5573 EXPECT_TRUE(service->extensions_enabled()); 5585 EXPECT_TRUE(service->extensions_enabled());
5574 service->Init(); 5586 service->Init();
5575 content::RunAllBlockingPoolTasksUntilIdle(); 5587 content::RunAllBlockingPoolTasksUntilIdle();
5576 EXPECT_TRUE(recorder.ready()); 5588 EXPECT_TRUE(recorder.ready());
5589 #if defined OS_CHROMEOS
5590 user_manager.reset();
5591 #endif
5577 5592
5578 // If either the command line or pref is set, we are disabled. 5593 // If either the command line or pref is set, we are disabled.
5579 recorder.set_ready(false); 5594 recorder.set_ready(false);
5580 profile.reset(new TestingProfile()); 5595 profile.reset(new TestingProfile());
5581 command_line->AppendSwitch(switches::kDisableExtensions); 5596 command_line->AppendSwitch(switches::kDisableExtensions);
5582 service = static_cast<extensions::TestExtensionSystem*>( 5597 service = static_cast<extensions::TestExtensionSystem*>(
5583 ExtensionSystem::Get(profile.get()))-> 5598 ExtensionSystem::Get(profile.get()))->
5584 CreateExtensionService( 5599 CreateExtensionService(
5585 command_line.get(), 5600 command_line.get(),
5586 install_dir, 5601 install_dir,
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
6944 shared_module->manifest()->type()); 6959 shared_module->manifest()->type());
6945 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); 6960 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId));
6946 6961
6947 // Reload the extension and wait for it to complete. This previously crashed 6962 // Reload the extension and wait for it to complete. This previously crashed
6948 // (see crbug.com/676815). 6963 // (see crbug.com/676815).
6949 service()->ReloadExtension(kExtensionId); 6964 service()->ReloadExtension(kExtensionId);
6950 content::RunAllBlockingPoolTasksUntilIdle(); 6965 content::RunAllBlockingPoolTasksUntilIdle();
6951 // The shared module should be enabled. 6966 // The shared module should be enabled.
6952 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId)); 6967 EXPECT_TRUE(registry()->enabled_extensions().Contains(kExtensionId));
6953 } 6968 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698