OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
11 #include "chrome/browser/extensions/browser_action_test_util.h" | 11 #include "chrome/browser/extensions/browser_action_test_util.h" |
12 #include "chrome/browser/extensions/extension_action_test_util.h" | |
13 #include "chrome/browser/extensions/extension_apitest.h" | 12 #include "chrome/browser/extensions/extension_apitest.h" |
14 #include "chrome/browser/extensions/lazy_background_page_test_util.h" | 13 #include "chrome/browser/extensions/lazy_background_page_test_util.h" |
15 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/location_bar/location_bar.h" | 17 #include "chrome/browser/ui/location_bar/location_bar.h" |
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
20 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
(...skipping 12 matching lines...) Expand all Loading... |
35 #include "extensions/common/extension.h" | 34 #include "extensions/common/extension.h" |
36 #include "extensions/test/extension_test_message_listener.h" | 35 #include "extensions/test/extension_test_message_listener.h" |
37 #include "extensions/test/result_catcher.h" | 36 #include "extensions/test/result_catcher.h" |
38 #include "net/dns/mock_host_resolver.h" | 37 #include "net/dns/mock_host_resolver.h" |
39 #include "net/test/embedded_test_server/embedded_test_server.h" | 38 #include "net/test/embedded_test_server/embedded_test_server.h" |
40 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
41 #include "url/gurl.h" | 40 #include "url/gurl.h" |
42 | 41 |
43 using bookmarks::BookmarkModel; | 42 using bookmarks::BookmarkModel; |
44 using bookmarks::BookmarkNode; | 43 using bookmarks::BookmarkNode; |
45 | 44 using extensions::Extension; |
46 namespace extensions { | 45 using extensions::ResultCatcher; |
47 | 46 |
48 namespace { | 47 namespace { |
49 | 48 |
50 // This unfortunate bit of silliness is necessary when loading an extension in | 49 // This unfortunate bit of silliness is necessary when loading an extension in |
51 // incognito. The goal is to load the extension, enable incognito, then wait | 50 // incognito. The goal is to load the extension, enable incognito, then wait |
52 // for both background pages to load and close. The problem is that enabling | 51 // for both background pages to load and close. The problem is that enabling |
53 // incognito involves reloading the extension - and the background pages may | 52 // incognito involves reloading the extension - and the background pages may |
54 // have already loaded once before then. So we wait until the extension is | 53 // have already loaded once before then. So we wait until the extension is |
55 // unloaded before listening to the background page notifications. | 54 // unloaded before listening to the background page notifications. |
56 class LoadedIncognitoObserver : public ExtensionRegistryObserver { | 55 class LoadedIncognitoObserver : public extensions::ExtensionRegistryObserver { |
57 public: | 56 public: |
58 explicit LoadedIncognitoObserver(Profile* profile) | 57 explicit LoadedIncognitoObserver(Profile* profile) |
59 : profile_(profile), extension_registry_observer_(this) { | 58 : profile_(profile), extension_registry_observer_(this) { |
60 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); | 59 extension_registry_observer_.Add( |
| 60 extensions::ExtensionRegistry::Get(profile_)); |
61 } | 61 } |
62 | 62 |
63 void Wait() { | 63 void Wait() { |
64 ASSERT_TRUE(original_complete_.get()); | 64 ASSERT_TRUE(original_complete_.get()); |
65 original_complete_->Wait(); | 65 original_complete_->Wait(); |
66 incognito_complete_->Wait(); | 66 incognito_complete_->Wait(); |
67 } | 67 } |
68 | 68 |
69 private: | 69 private: |
70 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 70 void OnExtensionUnloaded( |
71 const Extension* extension, | 71 content::BrowserContext* browser_context, |
72 UnloadedExtensionInfo::Reason reason) override { | 72 const Extension* extension, |
| 73 extensions::UnloadedExtensionInfo::Reason reason) override { |
73 original_complete_.reset(new LazyBackgroundObserver(profile_)); | 74 original_complete_.reset(new LazyBackgroundObserver(profile_)); |
74 incognito_complete_.reset( | 75 incognito_complete_.reset( |
75 new LazyBackgroundObserver(profile_->GetOffTheRecordProfile())); | 76 new LazyBackgroundObserver(profile_->GetOffTheRecordProfile())); |
76 } | 77 } |
77 | 78 |
78 Profile* profile_; | 79 Profile* profile_; |
79 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 80 ScopedObserver<extensions::ExtensionRegistry, |
| 81 extensions::ExtensionRegistryObserver> |
80 extension_registry_observer_; | 82 extension_registry_observer_; |
81 scoped_ptr<LazyBackgroundObserver> original_complete_; | 83 scoped_ptr<LazyBackgroundObserver> original_complete_; |
82 scoped_ptr<LazyBackgroundObserver> incognito_complete_; | 84 scoped_ptr<LazyBackgroundObserver> incognito_complete_; |
83 }; | 85 }; |
84 | 86 |
85 } // namespace | 87 } // namespace |
86 | 88 |
87 class LazyBackgroundPageApiTest : public ExtensionApiTest { | 89 class LazyBackgroundPageApiTest : public ExtensionApiTest { |
88 public: | 90 public: |
89 LazyBackgroundPageApiTest() {} | 91 LazyBackgroundPageApiTest() {} |
90 ~LazyBackgroundPageApiTest() override {} | 92 ~LazyBackgroundPageApiTest() override {} |
91 | 93 |
92 void SetUpInProcessBrowserTestFixture() override { | 94 void SetUpInProcessBrowserTestFixture() override { |
93 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 95 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
94 // Set shorter delays to prevent test timeouts. | 96 // Set shorter delays to prevent test timeouts. |
95 ProcessManager::SetEventPageIdleTimeForTesting(1); | 97 extensions::ProcessManager::SetEventPageIdleTimeForTesting(1); |
96 ProcessManager::SetEventPageSuspendingTimeForTesting(1); | 98 extensions::ProcessManager::SetEventPageSuspendingTimeForTesting(1); |
97 } | 99 } |
98 | 100 |
99 void SetUpCommandLine(base::CommandLine* command_line) override { | 101 void SetUpCommandLine(base::CommandLine* command_line) override { |
100 ExtensionApiTest::SetUpCommandLine(command_line); | 102 ExtensionApiTest::SetUpCommandLine(command_line); |
101 // Disable background network activity as it can suddenly bring the Lazy | 103 // Disable background network activity as it can suddenly bring the Lazy |
102 // Background Page alive. | 104 // Background Page alive. |
103 command_line->AppendSwitch(switches::kDisableBackgroundNetworking); | 105 command_line->AppendSwitch(switches::kDisableBackgroundNetworking); |
104 command_line->AppendSwitch(switches::kNoProxyServer); | 106 command_line->AppendSwitch(switches::kNoProxyServer); |
105 } | 107 } |
106 | 108 |
107 // Loads the extension, which temporarily starts the lazy background page | 109 // Loads the extension, which temporarily starts the lazy background page |
108 // to dispatch the onInstalled event. We wait until it shuts down again. | 110 // to dispatch the onInstalled event. We wait until it shuts down again. |
109 const Extension* LoadExtensionAndWait(const std::string& test_name) { | 111 const Extension* LoadExtensionAndWait(const std::string& test_name) { |
110 LazyBackgroundObserver page_complete; | 112 LazyBackgroundObserver page_complete; |
111 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). | 113 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). |
112 AppendASCII(test_name); | 114 AppendASCII(test_name); |
113 const Extension* extension = LoadExtension(extdir); | 115 const Extension* extension = LoadExtension(extdir); |
114 if (extension) | 116 if (extension) |
115 page_complete.Wait(); | 117 page_complete.Wait(); |
116 return extension; | 118 return extension; |
117 } | 119 } |
118 | 120 |
119 // Returns true if the lazy background page for the extension with | 121 // Returns true if the lazy background page for the extension with |
120 // |extension_id| is still running. | 122 // |extension_id| is still running. |
121 bool IsBackgroundPageAlive(const std::string& extension_id) { | 123 bool IsBackgroundPageAlive(const std::string& extension_id) { |
122 ProcessManager* pm = ProcessManager::Get(browser()->profile()); | 124 extensions::ProcessManager* pm = |
| 125 extensions::ProcessManager::Get(browser()->profile()); |
123 return pm->GetBackgroundHostForExtension(extension_id); | 126 return pm->GetBackgroundHostForExtension(extension_id); |
124 } | 127 } |
125 | 128 |
126 private: | 129 private: |
127 DISALLOW_COPY_AND_ASSIGN(LazyBackgroundPageApiTest); | 130 DISALLOW_COPY_AND_ASSIGN(LazyBackgroundPageApiTest); |
128 }; | 131 }; |
129 | 132 |
130 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BrowserActionCreateTab) { | 133 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, BrowserActionCreateTab) { |
131 ASSERT_TRUE(LoadExtensionAndWait("browser_action_create_tab")); | 134 ASSERT_TRUE(LoadExtensionAndWait("browser_action_create_tab")); |
132 | 135 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // Open a tab to a URL that will trigger the page action to show. | 184 // Open a tab to a URL that will trigger the page action to show. |
182 LazyBackgroundObserver page_complete; | 185 LazyBackgroundObserver page_complete; |
183 ui_test_utils::NavigateToURL( | 186 ui_test_utils::NavigateToURL( |
184 browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); | 187 browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); |
185 page_complete.Wait(); | 188 page_complete.Wait(); |
186 | 189 |
187 EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id())); | 190 EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id())); |
188 | 191 |
189 // Page action is shown. | 192 // Page action is shown. |
190 WaitForPageActionVisibilityChangeTo(num_page_actions + 1); | 193 WaitForPageActionVisibilityChangeTo(num_page_actions + 1); |
191 EXPECT_EQ(static_cast<size_t>(num_page_actions + 1), | 194 EXPECT_EQ(num_page_actions + 1, |
192 extension_action_test_util::GetVisiblePageActionCount( | 195 browser()->window()->GetLocationBar()-> |
193 browser()->tab_strip_model()->GetActiveWebContents())); | 196 GetLocationBarForTesting()->PageActionVisibleCount()); |
194 } | 197 } |
195 | 198 |
196 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, Filters) { | 199 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, Filters) { |
197 ASSERT_TRUE(StartEmbeddedTestServer()); | 200 ASSERT_TRUE(StartEmbeddedTestServer()); |
198 | 201 |
199 const Extension* extension = LoadExtensionAndWait("filters"); | 202 const Extension* extension = LoadExtensionAndWait("filters"); |
200 ASSERT_TRUE(extension); | 203 ASSERT_TRUE(extension); |
201 | 204 |
202 // Lazy Background Page doesn't exist yet. | 205 // Lazy Background Page doesn't exist yet. |
203 EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id())); | 206 EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id())); |
(...skipping 25 matching lines...) Expand all Loading... |
229 ASSERT_TRUE(extension); | 232 ASSERT_TRUE(extension); |
230 | 233 |
231 // The test extension opens a dialog on installation. | 234 // The test extension opens a dialog on installation. |
232 app_modal::AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog(); | 235 app_modal::AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog(); |
233 ASSERT_TRUE(dialog); | 236 ASSERT_TRUE(dialog); |
234 | 237 |
235 // With the dialog open the background page is still alive. | 238 // With the dialog open the background page is still alive. |
236 EXPECT_TRUE(IsBackgroundPageAlive(extension->id())); | 239 EXPECT_TRUE(IsBackgroundPageAlive(extension->id())); |
237 | 240 |
238 // Close the dialog. The keep alive count is decremented. | 241 // Close the dialog. The keep alive count is decremented. |
239 ProcessManager* pm = ProcessManager::Get(browser()->profile()); | 242 extensions::ProcessManager* pm = |
| 243 extensions::ProcessManager::Get(browser()->profile()); |
240 int previous_keep_alive_count = pm->GetLazyKeepaliveCount(extension); | 244 int previous_keep_alive_count = pm->GetLazyKeepaliveCount(extension); |
241 dialog->CloseModalDialog(); | 245 dialog->CloseModalDialog(); |
242 EXPECT_EQ(previous_keep_alive_count - 1, | 246 EXPECT_EQ(previous_keep_alive_count - 1, |
243 pm->GetLazyKeepaliveCount(extension)); | 247 pm->GetLazyKeepaliveCount(extension)); |
244 | 248 |
245 // The background page closes now that the dialog is gone. | 249 // The background page closes now that the dialog is gone. |
246 background_observer.WaitUntilClosed(); | 250 background_observer.WaitUntilClosed(); |
247 EXPECT_FALSE(IsBackgroundPageAlive(extension->id())); | 251 EXPECT_FALSE(IsBackgroundPageAlive(extension->id())); |
248 } | 252 } |
249 | 253 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 288 |
285 LazyBackgroundObserver page_complete; | 289 LazyBackgroundObserver page_complete; |
286 ResultCatcher catcher; | 290 ResultCatcher catcher; |
287 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). | 291 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). |
288 AppendASCII("wait_for_request"); | 292 AppendASCII("wait_for_request"); |
289 const Extension* extension = LoadExtension(extdir); | 293 const Extension* extension = LoadExtension(extdir); |
290 ASSERT_TRUE(extension); | 294 ASSERT_TRUE(extension); |
291 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 295 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
292 | 296 |
293 // Lazy Background Page still exists, because the extension started a request. | 297 // Lazy Background Page still exists, because the extension started a request. |
294 ProcessManager* pm = ProcessManager::Get(browser()->profile()); | 298 extensions::ProcessManager* pm = |
295 ExtensionHost* host = | 299 extensions::ProcessManager::Get(browser()->profile()); |
| 300 extensions::ExtensionHost* host = |
296 pm->GetBackgroundHostForExtension(last_loaded_extension_id()); | 301 pm->GetBackgroundHostForExtension(last_loaded_extension_id()); |
297 ASSERT_TRUE(host); | 302 ASSERT_TRUE(host); |
298 | 303 |
299 // Abort the request. | 304 // Abort the request. |
300 bool result = false; | 305 bool result = false; |
301 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 306 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
302 host->render_view_host(), "abortRequest()", &result)); | 307 host->render_view_host(), "abortRequest()", &result)); |
303 EXPECT_TRUE(result); | 308 EXPECT_TRUE(result); |
304 page_complete.Wait(); | 309 page_complete.Wait(); |
305 | 310 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // Load the extension with incognito enabled. | 392 // Load the extension with incognito enabled. |
388 { | 393 { |
389 LoadedIncognitoObserver loaded(browser()->profile()); | 394 LoadedIncognitoObserver loaded(browser()->profile()); |
390 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). | 395 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). |
391 AppendASCII("incognito_split"); | 396 AppendASCII("incognito_split"); |
392 ASSERT_TRUE(LoadExtensionIncognito(extdir)); | 397 ASSERT_TRUE(LoadExtensionIncognito(extdir)); |
393 loaded.Wait(); | 398 loaded.Wait(); |
394 } | 399 } |
395 | 400 |
396 // Lazy Background Page doesn't exist yet. | 401 // Lazy Background Page doesn't exist yet. |
397 ProcessManager* pm = ProcessManager::Get(browser()->profile()); | 402 extensions::ProcessManager* pm = |
398 ProcessManager* pmi = ProcessManager::Get(incognito_browser->profile()); | 403 extensions::ProcessManager::Get(browser()->profile()); |
| 404 extensions::ProcessManager* pmi = |
| 405 extensions::ProcessManager::Get(incognito_browser->profile()); |
399 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); | 406 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); |
400 EXPECT_FALSE(pmi->GetBackgroundHostForExtension(last_loaded_extension_id())); | 407 EXPECT_FALSE(pmi->GetBackgroundHostForExtension(last_loaded_extension_id())); |
401 | 408 |
402 // Trigger a browserAction event in the original profile and ensure only | 409 // Trigger a browserAction event in the original profile and ensure only |
403 // the original event page received it (since the event is scoped to the | 410 // the original event page received it (since the event is scoped to the |
404 // profile). | 411 // profile). |
405 { | 412 { |
406 ExtensionTestMessageListener listener("waiting", false); | 413 ExtensionTestMessageListener listener("waiting", false); |
407 ExtensionTestMessageListener listener_incognito("waiting_incognito", false); | 414 ExtensionTestMessageListener listener_incognito("waiting_incognito", false); |
408 | 415 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } | 481 } |
475 | 482 |
476 // Tests that a KeepaliveImpulse increments the keep alive count, but eventually | 483 // Tests that a KeepaliveImpulse increments the keep alive count, but eventually |
477 // times out and background page will still close. | 484 // times out and background page will still close. |
478 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, ImpulseAddsCount) { | 485 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, ImpulseAddsCount) { |
479 ASSERT_TRUE(StartEmbeddedTestServer()); | 486 ASSERT_TRUE(StartEmbeddedTestServer()); |
480 const Extension* extension = LoadExtensionAndWait("messaging"); | 487 const Extension* extension = LoadExtensionAndWait("messaging"); |
481 ASSERT_TRUE(extension); | 488 ASSERT_TRUE(extension); |
482 | 489 |
483 // Lazy Background Page doesn't exist yet. | 490 // Lazy Background Page doesn't exist yet. |
484 ProcessManager* pm = ProcessManager::Get(browser()->profile()); | 491 extensions::ProcessManager* pm = |
| 492 extensions::ProcessManager::Get(browser()->profile()); |
485 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); | 493 EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); |
486 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 494 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
487 | 495 |
488 // Navigate to a page that opens a message channel to the background page. | 496 // Navigate to a page that opens a message channel to the background page. |
489 ResultCatcher catcher; | 497 ResultCatcher catcher; |
490 LazyBackgroundObserver lazybg; | 498 LazyBackgroundObserver lazybg; |
491 ui_test_utils::NavigateToURL( | 499 ui_test_utils::NavigateToURL( |
492 browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); | 500 browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); |
493 lazybg.WaitUntilLoaded(); | 501 lazybg.WaitUntilLoaded(); |
494 | 502 |
(...skipping 25 matching lines...) Expand all Loading... |
520 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); | 528 ASSERT_EQ(1, browser_action.NumberOfBrowserActions()); |
521 EXPECT_EQ("Success", browser_action.GetTooltip(0)); | 529 EXPECT_EQ("Success", browser_action.GetTooltip(0)); |
522 } | 530 } |
523 | 531 |
524 // Tests that both a regular page and an event page will receive events when | 532 // Tests that both a regular page and an event page will receive events when |
525 // the event page is not loaded. | 533 // the event page is not loaded. |
526 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, EventDispatchToTab) { | 534 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, EventDispatchToTab) { |
527 ResultCatcher catcher; | 535 ResultCatcher catcher; |
528 catcher.RestrictToBrowserContext(browser()->profile()); | 536 catcher.RestrictToBrowserContext(browser()->profile()); |
529 | 537 |
530 const Extension* extension = LoadExtensionAndWait("event_dispatch_to_tab"); | 538 const extensions::Extension* extension = |
| 539 LoadExtensionAndWait("event_dispatch_to_tab"); |
531 | 540 |
532 ExtensionTestMessageListener page_ready("ready", true); | 541 ExtensionTestMessageListener page_ready("ready", true); |
533 GURL page_url = extension->GetResourceURL("page.html"); | 542 GURL page_url = extension->GetResourceURL("page.html"); |
534 ui_test_utils::NavigateToURL(browser(), page_url); | 543 ui_test_utils::NavigateToURL(browser(), page_url); |
535 EXPECT_TRUE(page_ready.WaitUntilSatisfied()); | 544 EXPECT_TRUE(page_ready.WaitUntilSatisfied()); |
536 | 545 |
537 // After the event is sent below, wait for the event page to have received | 546 // After the event is sent below, wait for the event page to have received |
538 // the event before proceeding with the test. This allows the regular page | 547 // the event before proceeding with the test. This allows the regular page |
539 // to test that the event page received the event, which makes the pass/fail | 548 // to test that the event page received the event, which makes the pass/fail |
540 // logic simpler. | 549 // logic simpler. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 623 |
615 // Tests that the lazy background page will be unloaded if the onSuspend event | 624 // Tests that the lazy background page will be unloaded if the onSuspend event |
616 // handler calls an API function such as chrome.storage.local.set(). | 625 // handler calls an API function such as chrome.storage.local.set(). |
617 // See: http://crbug.com/296834 | 626 // See: http://crbug.com/296834 |
618 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { | 627 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { |
619 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); | 628 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); |
620 } | 629 } |
621 | 630 |
622 // TODO: background page with timer. | 631 // TODO: background page with timer. |
623 // TODO: background page that interacts with popup. | 632 // TODO: background page that interacts with popup. |
624 | |
625 } // namespace extensions | |
OLD | NEW |