| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 base::ReplaceChars(manifest_json, "'", "\"", &manifest_json); | 102 base::ReplaceChars(manifest_json, "'", "\"", &manifest_json); |
| 103 extension_dir.WriteManifest(manifest_json); | 103 extension_dir.WriteManifest(manifest_json); |
| 104 // Empty background page. Closing/opening it is driven by this test. | 104 // Empty background page. Closing/opening it is driven by this test. |
| 105 extension_dir.WriteFile(FILE_PATH_LITERAL("background.js"), ""); | 105 extension_dir.WriteFile(FILE_PATH_LITERAL("background.js"), ""); |
| 106 extension_dir.WriteFile(FILE_PATH_LITERAL("content_script.js"), | 106 extension_dir.WriteFile(FILE_PATH_LITERAL("content_script.js"), |
| 107 kContentScriptJs); | 107 kContentScriptJs); |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Install the extension, then close its background page if desired.. | 110 // Install the extension, then close its background page if desired.. |
| 111 const Extension* extension = LoadExtension(extension_dir.unpacked_path()); | 111 const Extension* extension = LoadExtension(extension_dir.UnpackedPath()); |
| 112 CHECK(extension); | 112 CHECK(extension); |
| 113 | 113 |
| 114 // Regardless of |will_be_open|, we haven't closed the background page yet, | 114 // Regardless of |will_be_open|, we haven't closed the background page yet, |
| 115 // so it should always open if it exists. | 115 // so it should always open if it exists. |
| 116 if (bg_config != NONE) | 116 if (bg_config != NONE) |
| 117 BackgroundPageWatcher(process_manager(), extension).WaitForOpen(); | 117 BackgroundPageWatcher(process_manager(), extension).WaitForOpen(); |
| 118 | 118 |
| 119 if (should_close) { | 119 if (should_close) { |
| 120 GetBackgroundPage(extension->id())->Close(); | 120 GetBackgroundPage(extension->id())->Close(); |
| 121 BackgroundPageWatcher(process_manager(), extension).WaitForClose(); | 121 BackgroundPageWatcher(process_manager(), extension).WaitForClose(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 true /* will_be_open */); | 177 true /* will_be_open */); |
| 178 } | 178 } |
| 179 | 179 |
| 180 IN_PROC_BROWSER_TEST_F(WakeEventPageTest, NoBackgroundPage) { | 180 IN_PROC_BROWSER_TEST_F(WakeEventPageTest, NoBackgroundPage) { |
| 181 RunTest(false /* expect_success */, NONE, false /* should_close */, | 181 RunTest(false /* expect_success */, NONE, false /* should_close */, |
| 182 false /* will_be_open */); | 182 false /* will_be_open */); |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace | 185 } // namespace |
| 186 } // namespace extensions | 186 } // namespace extensions |
| OLD | NEW |