Chromium Code Reviews| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, MAYBE_WaitForNTP) { | 278 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, MAYBE_WaitForNTP) { |
| 279 LazyBackgroundObserver lazybg; | 279 LazyBackgroundObserver lazybg; |
| 280 ResultCatcher catcher; | 280 ResultCatcher catcher; |
| 281 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). | 281 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). |
| 282 AppendASCII("wait_for_ntp"); | 282 AppendASCII("wait_for_ntp"); |
| 283 const Extension* extension = LoadExtension(extdir); | 283 const Extension* extension = LoadExtension(extdir); |
| 284 ASSERT_TRUE(extension); | 284 ASSERT_TRUE(extension); |
| 285 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 285 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 286 | 286 |
| 287 // The extension should've opened a new tab to an extension page. | 287 // The extension should've opened a new tab to an extension page. |
| 288 EXPECT_TRUE(chrome::IsNTPURL( | 288 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), |
|
sky
2013/10/07 20:30:59
nit: I believe EXPECT_EQ on the spec of the urls g
samarth
2013/10/11 22:26:04
Done.
| |
| 289 browser()->tab_strip_model()->GetActiveWebContents()->GetURL(), | 289 browser()->tab_strip_model()->GetActiveWebContents()->GetURL()); |
| 290 browser()->profile())); | |
| 291 | 290 |
| 292 // Lazy Background Page still exists, because the extension created a new tab | 291 // Lazy Background Page still exists, because the extension created a new tab |
| 293 // to an extension page. | 292 // to an extension page. |
| 294 ExtensionProcessManager* pm = | 293 ExtensionProcessManager* pm = |
| 295 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); | 294 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); |
| 296 EXPECT_TRUE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); | 295 EXPECT_TRUE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); |
| 297 | 296 |
| 298 // Navigate away from the NTP, which should close the event page. | 297 // Navigate away from the NTP, which should close the event page. |
| 299 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 298 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
| 300 lazybg.Wait(); | 299 lazybg.Wait(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 | 506 |
| 508 // Tests that the lazy background page will be unloaded if the onSuspend event | 507 // Tests that the lazy background page will be unloaded if the onSuspend event |
| 509 // handler calls an API function such as chrome.storage.local.set(). | 508 // handler calls an API function such as chrome.storage.local.set(). |
| 510 // See: http://crbug.com/296834 | 509 // See: http://crbug.com/296834 |
| 511 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { | 510 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { |
| 512 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); | 511 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); |
| 513 } | 512 } |
| 514 | 513 |
| 515 // TODO: background page with timer. | 514 // TODO: background page with timer. |
| 516 // TODO: background page that interacts with popup. | 515 // TODO: background page that interacts with popup. |
| OLD | NEW |