OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browsertest_util.h" | 5 #include "chrome/browser/extensions/browsertest_util.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const std::string& extension_id, | 44 const std::string& extension_id, |
45 const std::string& script) { | 45 const std::string& script) { |
46 extensions::ProcessManager* manager = | 46 extensions::ProcessManager* manager = |
47 extensions::ProcessManager::Get(profile); | 47 extensions::ProcessManager::Get(profile); |
48 extensions::ExtensionHost* host = | 48 extensions::ExtensionHost* host = |
49 manager->GetBackgroundHostForExtension(extension_id); | 49 manager->GetBackgroundHostForExtension(extension_id); |
50 if (host == NULL) { | 50 if (host == NULL) { |
51 ADD_FAILURE() << "Extension " << extension_id << " has no background page."; | 51 ADD_FAILURE() << "Extension " << extension_id << " has no background page."; |
52 return false; | 52 return false; |
53 } | 53 } |
54 return content::ExecuteScript(host->host_contents(), script); | 54 content::ExecuteUnmodifiedScript(host->host_contents(), script); |
| 55 return true; |
55 } | 56 } |
56 | 57 |
57 void CreateAndInitializeLocalCache() { | 58 void CreateAndInitializeLocalCache() { |
58 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
59 base::FilePath extension_cache_dir; | 60 base::FilePath extension_cache_dir; |
60 CHECK(PathService::Get(chromeos::DIR_DEVICE_EXTENSION_LOCAL_CACHE, | 61 CHECK(PathService::Get(chromeos::DIR_DEVICE_EXTENSION_LOCAL_CACHE, |
61 &extension_cache_dir)); | 62 &extension_cache_dir)); |
62 base::FilePath cache_init_file = extension_cache_dir.Append( | 63 base::FilePath cache_init_file = extension_cache_dir.Append( |
63 extensions::LocalExtensionCache::kCacheReadyFlagFileName); | 64 extensions::LocalExtensionCache::kCacheReadyFlagFileName); |
64 EXPECT_EQ(base::WriteFile(cache_init_file, "", 0), 0); | 65 EXPECT_EQ(base::WriteFile(cache_init_file, "", 0), 0); |
65 #endif | 66 #endif |
66 } | 67 } |
67 | 68 |
68 } // namespace browsertest_util | 69 } // namespace browsertest_util |
69 } // namespace extensions | 70 } // namespace extensions |
OLD | NEW |