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

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

Issue 11027070: Moved JsonPrefStore to use SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
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/extensions/extension_service_unittest.h" 5 #include "chrome/browser/extensions/extension_service_unittest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/json/json_file_value_serializer.h" 15 #include "base/json/json_file_value_serializer.h"
16 #include "base/json/json_reader.h" 16 #include "base/json/json_reader.h"
17 #include "base/json/json_string_value_serializer.h" 17 #include "base/json/json_string_value_serializer.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/message_loop.h" 20 #include "base/message_loop.h"
21 #include "base/path_service.h" 21 #include "base/path_service.h"
22 #include "base/scoped_temp_dir.h" 22 #include "base/scoped_temp_dir.h"
23 #include "base/stl_util.h" 23 #include "base/stl_util.h"
24 #include "base/string16.h" 24 #include "base/string16.h"
25 #include "base/string_number_conversions.h" 25 #include "base/string_number_conversions.h"
26 #include "base/string_util.h" 26 #include "base/string_util.h"
27 #include "base/threading/sequenced_worker_pool.h"
akalin 2012/10/19 02:00:51 this isn't needed anymore, is it?
zel 2012/10/19 18:45:07 Done.
27 #include "base/utf_string_conversions.h" 28 #include "base/utf_string_conversions.h"
28 #include "base/version.h" 29 #include "base/version.h"
29 #include "chrome/browser/browser_process.h" 30 #include "chrome/browser/browser_process.h"
30 #include "chrome/browser/extensions/app_sync_data.h" 31 #include "chrome/browser/extensions/app_sync_data.h"
31 #include "chrome/browser/extensions/component_loader.h" 32 #include "chrome/browser/extensions/component_loader.h"
32 #include "chrome/browser/extensions/crx_installer.h" 33 #include "chrome/browser/extensions/crx_installer.h"
33 #include "chrome/browser/extensions/default_apps.h" 34 #include "chrome/browser/extensions/default_apps.h"
34 #include "chrome/browser/extensions/extension_creator.h" 35 #include "chrome/browser/extensions/extension_creator.h"
35 #include "chrome/browser/extensions/extension_error_reporter.h" 36 #include "chrome/browser/extensions/extension_error_reporter.h"
36 #include "chrome/browser/extensions/extension_error_ui.h" 37 #include "chrome/browser/extensions/extension_error_ui.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 data_dir_ = test_data_dir.AppendASCII("extensions"); 403 data_dir_ = test_data_dir.AppendASCII("extensions");
403 } 404 }
404 405
405 ExtensionServiceTestBase::~ExtensionServiceTestBase() { 406 ExtensionServiceTestBase::~ExtensionServiceTestBase() {
406 // Drop our reference to ExtensionService and TestingProfile, so that they 407 // Drop our reference to ExtensionService and TestingProfile, so that they
407 // can be destroyed while BrowserThreads and MessageLoop are still around 408 // can be destroyed while BrowserThreads and MessageLoop are still around
408 // (they are used in the destruction process). 409 // (they are used in the destruction process).
409 service_ = NULL; 410 service_ = NULL;
410 MessageLoop::current()->RunAllPending(); 411 MessageLoop::current()->RunAllPending();
411 profile_.reset(NULL); 412 profile_.reset(NULL);
413 BrowserThread::GetBlockingPool()->FlushForTesting();
akalin 2012/10/19 02:00:51 this isn't needed anymore, is it?
zel 2012/10/19 18:45:07 Done.
412 MessageLoop::current()->RunAllPending(); 414 MessageLoop::current()->RunAllPending();
413 } 415 }
414 416
415 void ExtensionServiceTestBase::InitializeExtensionService( 417 void ExtensionServiceTestBase::InitializeExtensionService(
416 const FilePath& profile_path, 418 const FilePath& profile_path,
417 const FilePath& pref_file, 419 const FilePath& pref_file,
418 const FilePath& extensions_install_dir, 420 const FilePath& extensions_install_dir,
419 bool autoupdate_enabled) { 421 bool autoupdate_enabled) {
420 TestingProfile::Builder profile_builder; 422 TestingProfile::Builder profile_builder;
421 // Create a PrefService that only contains user defined preference values. 423 // Create a PrefService that only contains user defined preference values.
422 scoped_ptr<PrefService> prefs( 424 scoped_ptr<PrefService> prefs(
423 PrefServiceMockBuilder().WithUserFilePrefs(pref_file).Create()); 425 PrefServiceMockBuilder().WithUserFilePrefs(
426 pref_file, loop_.message_loop_proxy()).Create());
424 Profile::RegisterUserPrefs(prefs.get()); 427 Profile::RegisterUserPrefs(prefs.get());
425 chrome::RegisterUserPrefs(prefs.get()); 428 chrome::RegisterUserPrefs(prefs.get());
426 profile_builder.SetPrefService(prefs.Pass()); 429 profile_builder.SetPrefService(prefs.Pass());
427 profile_builder.SetPath(profile_path); 430 profile_builder.SetPath(profile_path);
428 profile_ = profile_builder.Build(); 431 profile_ = profile_builder.Build();
429 432
430 service_ = static_cast<extensions::TestExtensionSystem*>( 433 service_ = static_cast<extensions::TestExtensionSystem*>(
431 ExtensionSystem::Get(profile_.get()))->CreateExtensionService( 434 ExtensionSystem::Get(profile_.get()))->CreateExtensionService(
432 CommandLine::ForCurrentProcess(), 435 CommandLine::ForCurrentProcess(),
433 extensions_install_dir, 436 extensions_install_dir,
(...skipping 5230 matching lines...) Expand 10 before | Expand all | Expand 10 after
5664 EXPECT_FALSE(service_->IsExtensionEnabled(theme_crx)); 5667 EXPECT_FALSE(service_->IsExtensionEnabled(theme_crx));
5665 5668
5666 service_->EnableExtension(page_action); 5669 service_->EnableExtension(page_action);
5667 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); 5670 EXPECT_TRUE(extensions::HasExternalInstallError(service_));
5668 service_->EnableExtension(theme_crx); 5671 service_->EnableExtension(theme_crx);
5669 EXPECT_TRUE(extensions::HasExternalInstallError(service_)); 5672 EXPECT_TRUE(extensions::HasExternalInstallError(service_));
5670 service_->EnableExtension(good_crx); 5673 service_->EnableExtension(good_crx);
5671 EXPECT_FALSE(extensions::HasExternalInstallError(service_)); 5674 EXPECT_FALSE(extensions::HasExternalInstallError(service_));
5672 } 5675 }
5673 #endif // !defined(OS_CHROMEOS) 5676 #endif // !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698