| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" | 10 #include "chrome/browser/bookmarks/bookmark_test_helpers.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, MAYBE_WaitForNTP) { | 280 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, MAYBE_WaitForNTP) { |
| 281 LazyBackgroundObserver lazybg; | 281 LazyBackgroundObserver lazybg; |
| 282 ResultCatcher catcher; | 282 ResultCatcher catcher; |
| 283 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). | 283 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). |
| 284 AppendASCII("wait_for_ntp"); | 284 AppendASCII("wait_for_ntp"); |
| 285 const Extension* extension = LoadExtension(extdir); | 285 const Extension* extension = LoadExtension(extdir); |
| 286 ASSERT_TRUE(extension); | 286 ASSERT_TRUE(extension); |
| 287 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 287 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 288 | 288 |
| 289 // The extension should've opened a new tab to an extension page. | 289 // The extension should've opened a new tab to an extension page. |
| 290 EXPECT_TRUE(chrome::IsNTPURL( | 290 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
| 291 browser()->tab_strip_model()->GetActiveWebContents()->GetURL(), | 291 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 292 browser()->profile())); | |
| 293 | 292 |
| 294 // Lazy Background Page still exists, because the extension created a new tab | 293 // Lazy Background Page still exists, because the extension created a new tab |
| 295 // to an extension page. | 294 // to an extension page. |
| 296 extensions::ProcessManager* pm = | 295 extensions::ProcessManager* pm = |
| 297 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 296 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
| 298 EXPECT_TRUE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); | 297 EXPECT_TRUE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); |
| 299 | 298 |
| 300 // Navigate away from the NTP, which should close the event page. | 299 // Navigate away from the NTP, which should close the event page. |
| 301 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 300 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
| 302 lazybg.Wait(); | 301 lazybg.Wait(); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 510 |
| 512 // Tests that the lazy background page will be unloaded if the onSuspend event | 511 // Tests that the lazy background page will be unloaded if the onSuspend event |
| 513 // handler calls an API function such as chrome.storage.local.set(). | 512 // handler calls an API function such as chrome.storage.local.set(). |
| 514 // See: http://crbug.com/296834 | 513 // See: http://crbug.com/296834 |
| 515 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { | 514 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { |
| 516 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); | 515 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); |
| 517 } | 516 } |
| 518 | 517 |
| 519 // TODO: background page with timer. | 518 // TODO: background page with timer. |
| 520 // TODO: background page that interacts with popup. | 519 // TODO: background page that interacts with popup. |
| OLD | NEW |