summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrlp <rlp@chromium.org>2014-11-23 17:47:01 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-24 01:47:42 +0000
commit9f92e8cb010f447e713b22ed1ced0596eebe2585 (patch)
tree299937862fcc1753631b0160c20a16dadcdd5e71
parentd10dcfa425f4bffa37f12bc9e8315aa57f7a2538 (diff)
downloadchromium_src-9f92e8cb010f447e713b22ed1ced0596eebe2585.zip
chromium_src-9f92e8cb010f447e713b22ed1ced0596eebe2585.tar.gz
chromium_src-9f92e8cb010f447e713b22ed1ced0596eebe2585.tar.bz2
[Maintenance] Fix ComponentLoaderTests to properly handle destruction
of ProfileSyncService. When a transitive dependency on ProfileSyncService was added to hotwording, the LoadAll and AddOrReplace tests which load all component extensions including hotwording now needed to load ProfileSyncService. This resulted in a crash and as a temporary fix, sync was turned off in these two tests. We've now determined the proper fix which is to move the TestBrowserThreadBundle to be the first member so that it is deleted last. Previously, it was being deleted too soon and ProfileSyncService could not be shut down properly since that service is multithreaded. BUG=435629 TEST=Run ComponentLoaderTest.LoadAll or AddOrReplace and verify that it does not crash or fail a DCHECK Review URL: https://codereview.chromium.org/746943002 Cr-Commit-Position: refs/heads/master@{#305397}
-rw-r--r--chrome/browser/extensions/component_loader_unittest.cc11
1 files changed, 1 insertions, 10 deletions
diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc
index 7435928..c8625b1 100644
--- a/chrome/browser/extensions/component_loader_unittest.cc
+++ b/chrome/browser/extensions/component_loader_unittest.cc
@@ -105,6 +105,7 @@ class ComponentLoaderTest : public testing::Test {
}
protected:
+ content::TestBrowserThreadBundle thread_bundle_;
TestingProfile profile_;
MockExtensionService extension_service_;
TestingPrefServiceSyncable prefs_;
@@ -117,8 +118,6 @@ class ComponentLoaderTest : public testing::Test {
// The contents of the text extension's manifest file.
std::string manifest_contents_;
- content::TestBrowserThreadBundle thread_bundle_;
-
base::FilePath GetBasePath() {
base::FilePath test_data_dir;
PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
@@ -224,10 +223,6 @@ TEST_F(ComponentLoaderTest, Remove) {
}
TEST_F(ComponentLoaderTest, LoadAll) {
- // This loads the hotword component extension which has a dependency on sync.
- // However, this doesn't work with unittests so disable sync.
- base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableSync);
-
extension_service_.set_ready(false);
ExtensionRegistry* registry = ExtensionRegistry::Get(&profile_);
@@ -249,10 +244,6 @@ TEST_F(ComponentLoaderTest, LoadAll) {
}
TEST_F(ComponentLoaderTest, AddOrReplace) {
- // This loads the hotword component extension which has a dependency on sync.
- // However, this doesn't work with unittests so disable sync.
- base::CommandLine::ForCurrentProcess()->AppendSwitch(switches::kDisableSync);
-
EXPECT_EQ(0u, component_loader_.registered_extensions_count());
component_loader_.AddDefaultComponentExtensions(false);
size_t const default_count = component_loader_.registered_extensions_count();