| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_service_unittest.h" | 5 #include "chrome/browser/extensions/extensions_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 // Must setup the commandline here, since Extension caches the switch value | 245 // Must setup the commandline here, since Extension caches the switch value |
| 246 // when the prefs are registered. | 246 // when the prefs are registered. |
| 247 CommandLine::ForCurrentProcess()->AppendSwitch( | 247 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 248 switches::kEnableExtensionToolstrips); | 248 switches::kEnableExtensionToolstrips); |
| 249 CommandLine::ForCurrentProcess()->AppendSwitch( | 249 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 250 switches::kEnableApps); | 250 switches::kEnableApps); |
| 251 | 251 |
| 252 ExtensionTestingProfile* profile = new ExtensionTestingProfile(); | 252 ExtensionTestingProfile* profile = new ExtensionTestingProfile(); |
| 253 // Create a preference service that only contains user defined | 253 // Create a preference service that only contains user defined |
| 254 // preference values. | 254 // preference values. |
| 255 prefs_.reset(new PrefService(new PrefValueStore( | 255 prefs_.reset(PrefService::CreateUserPrefService(pref_file)); |
| 256 NULL, /* No managed preference values */ | |
| 257 new JsonPrefStore( /* user defined preference values */ | |
| 258 pref_file, | |
| 259 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::FILE)), | |
| 260 NULL /* No suggested preference values */))); | |
| 261 | 256 |
| 262 Profile::RegisterUserPrefs(prefs_.get()); | 257 Profile::RegisterUserPrefs(prefs_.get()); |
| 263 browser::RegisterUserPrefs(prefs_.get()); | 258 browser::RegisterUserPrefs(prefs_.get()); |
| 264 profile_.reset(profile); | 259 profile_.reset(profile); |
| 265 | 260 |
| 266 service_ = new ExtensionsService(profile_.get(), | 261 service_ = new ExtensionsService(profile_.get(), |
| 267 CommandLine::ForCurrentProcess(), | 262 CommandLine::ForCurrentProcess(), |
| 268 prefs_.get(), | 263 prefs_.get(), |
| 269 extensions_install_dir, | 264 extensions_install_dir, |
| 270 false); | 265 false); |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 // Component extensions shouldn't get recourded in the prefs. | 2094 // Component extensions shouldn't get recourded in the prefs. |
| 2100 ValidatePrefKeyCount(0); | 2095 ValidatePrefKeyCount(0); |
| 2101 | 2096 |
| 2102 // Reload all extensions, and make sure it comes back. | 2097 // Reload all extensions, and make sure it comes back. |
| 2103 std::string extension_id = service_->extensions()->at(0)->id(); | 2098 std::string extension_id = service_->extensions()->at(0)->id(); |
| 2104 loaded_.clear(); | 2099 loaded_.clear(); |
| 2105 service_->ReloadExtensions(); | 2100 service_->ReloadExtensions(); |
| 2106 ASSERT_EQ(1u, service_->extensions()->size()); | 2101 ASSERT_EQ(1u, service_->extensions()->size()); |
| 2107 EXPECT_EQ(extension_id, service_->extensions()->at(0)->id()); | 2102 EXPECT_EQ(extension_id, service_->extensions()->at(0)->id()); |
| 2108 } | 2103 } |
| OLD | NEW |