| 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/scoped_observer.h" | 7 #include "base/scoped_observer.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 // After the event is sent below, wait for the event page to have received | 509 // After the event is sent below, wait for the event page to have received |
| 510 // the event before proceeding with the test. This allows the regular page | 510 // the event before proceeding with the test. This allows the regular page |
| 511 // to test that the event page received the event, which makes the pass/fail | 511 // to test that the event page received the event, which makes the pass/fail |
| 512 // logic simpler. | 512 // logic simpler. |
| 513 ExtensionTestMessageListener event_page_ready("ready", true); | 513 ExtensionTestMessageListener event_page_ready("ready", true); |
| 514 | 514 |
| 515 // Send an event by making a bookmark. | 515 // Send an event by making a bookmark. |
| 516 BookmarkModel* bookmark_model = | 516 BookmarkModel* bookmark_model = |
| 517 BookmarkModelFactory::GetForProfile(browser()->profile()); | 517 BookmarkModelFactory::GetForProfile(browser()->profile()); |
| 518 test::WaitForBookmarkModelToLoad(bookmark_model); | 518 test::WaitForBookmarkModelToLoad(bookmark_model); |
| 519 bookmark_utils::AddIfNotBookmarked(bookmark_model, | 519 bookmarks::AddIfNotBookmarked(bookmark_model, |
| 520 GURL("http://www.google.com"), | 520 GURL("http://www.google.com"), |
| 521 base::UTF8ToUTF16("Google")); | 521 base::UTF8ToUTF16("Google")); |
| 522 | 522 |
| 523 EXPECT_TRUE(event_page_ready.WaitUntilSatisfied()); | 523 EXPECT_TRUE(event_page_ready.WaitUntilSatisfied()); |
| 524 | 524 |
| 525 page_ready.Reply("go"); | 525 page_ready.Reply("go"); |
| 526 | 526 |
| 527 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 527 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 528 } | 528 } |
| 529 | 529 |
| 530 // Tests that the lazy background page updates the chrome://extensions page | 530 // Tests that the lazy background page updates the chrome://extensions page |
| 531 // when it is destroyed. | 531 // when it is destroyed. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 | 575 |
| 576 // Tests that the lazy background page will be unloaded if the onSuspend event | 576 // Tests that the lazy background page will be unloaded if the onSuspend event |
| 577 // handler calls an API function such as chrome.storage.local.set(). | 577 // handler calls an API function such as chrome.storage.local.set(). |
| 578 // See: http://crbug.com/296834 | 578 // See: http://crbug.com/296834 |
| 579 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { | 579 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { |
| 580 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); | 580 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); |
| 581 } | 581 } |
| 582 | 582 |
| 583 // TODO: background page with timer. | 583 // TODO: background page with timer. |
| 584 // TODO: background page that interacts with popup. | 584 // TODO: background page that interacts with popup. |
| OLD | NEW |