OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/files/file_util.h" | 5 #include "chrome/browser/extensions/extension_garbage_collector_chromeos.h" |
6 | |
7 #include <string> | |
8 #include <vector> | |
9 | |
10 #include "base/file_util.h" | |
Lei Zhang
2014/09/19 21:10:13
Please be aware that this is going away. Use base/
| |
6 #include "base/prefs/scoped_user_pref_update.h" | 11 #include "base/prefs/scoped_user_pref_update.h" |
7 #include "base/prefs/testing_pref_service.h" | 12 #include "base/prefs/testing_pref_service.h" |
8 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
9 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
10 #include "base/values.h" | 15 #include "base/values.h" |
11 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 16 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
12 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 17 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
14 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" | 19 #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" |
15 #include "chrome/browser/extensions/extension_garbage_collector_chromeos.h" | |
16 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/extension_service_test_base.h" | 21 #include "chrome/browser/extensions/extension_service_test_base.h" |
18 #include "chrome/browser/prefs/browser_prefs.h" | 22 #include "chrome/browser/prefs/browser_prefs.h" |
19 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/test/base/testing_browser_process.h" | 24 #include "chrome/test/base/testing_browser_process.h" |
21 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
22 #include "chromeos/login/user_names.h" | 26 #include "chromeos/login/user_names.h" |
23 #include "components/user_manager/user_manager.h" | 27 #include "components/user_manager/user_manager.h" |
24 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/plugin_service.h" | 29 #include "content/public/browser/plugin_service.h" |
30 #include "content/public/test/test_utils.h" | |
26 #include "extensions/browser/extension_prefs.h" | 31 #include "extensions/browser/extension_prefs.h" |
27 #include "extensions/browser/install_flag.h" | 32 #include "extensions/browser/install_flag.h" |
28 #include "extensions/common/manifest_constants.h" | 33 #include "extensions/common/manifest_constants.h" |
29 | 34 |
30 namespace { | 35 namespace { |
31 const char kExtensionId1[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | 36 const char kExtensionId1[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; |
32 const char kExtensionId2[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; | 37 const char kExtensionId2[] = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"; |
33 } // namespace | 38 } // namespace |
34 | 39 |
35 namespace extensions { | 40 namespace extensions { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 } | 77 } |
73 | 78 |
74 virtual void TearDown() OVERRIDE { | 79 virtual void TearDown() OVERRIDE { |
75 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 80 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
76 } | 81 } |
77 | 82 |
78 void GarbageCollectExtensions() { | 83 void GarbageCollectExtensions() { |
79 ExtensionGarbageCollector::Get(profile_.get()) | 84 ExtensionGarbageCollector::Get(profile_.get()) |
80 ->GarbageCollectExtensionsForTest(); | 85 ->GarbageCollectExtensionsForTest(); |
81 // Wait for GarbageCollectExtensions task to complete. | 86 // Wait for GarbageCollectExtensions task to complete. |
82 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 87 content::RunAllBlockingPoolTasksUntilIdle(); |
83 } | 88 } |
84 | 89 |
85 base::FilePath CreateSharedExtensionDir(const std::string& id, | 90 base::FilePath CreateSharedExtensionDir(const std::string& id, |
86 const std::string& version, | 91 const std::string& version, |
87 const base::FilePath& shared_dir) { | 92 const base::FilePath& shared_dir) { |
88 base::FilePath path = shared_dir.AppendASCII(id).AppendASCII(version); | 93 base::FilePath path = shared_dir.AppendASCII(id).AppendASCII(version); |
89 CreateDirectory(path); | 94 CreateDirectory(path); |
90 return path; | 95 return path; |
91 } | 96 } |
92 | 97 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 | 196 |
192 const base::DictionaryValue* shared_extensions = local_state().GetDictionary( | 197 const base::DictionaryValue* shared_extensions = local_state().GetDictionary( |
193 ExtensionAssetsManagerChromeOS::kSharedExtensions); | 198 ExtensionAssetsManagerChromeOS::kSharedExtensions); |
194 ASSERT_TRUE(shared_extensions); | 199 ASSERT_TRUE(shared_extensions); |
195 | 200 |
196 EXPECT_FALSE(shared_extensions->HasKey(kExtensionId1)); | 201 EXPECT_FALSE(shared_extensions->HasKey(kExtensionId1)); |
197 EXPECT_TRUE(shared_extensions->HasKey(kExtensionId2)); | 202 EXPECT_TRUE(shared_extensions->HasKey(kExtensionId2)); |
198 } | 203 } |
199 | 204 |
200 } // namespace extensions | 205 } // namespace extensions |
OLD | NEW |