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