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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // This unfortunate bit of silliness is necessary when loading an extension in | 41 // This unfortunate bit of silliness is necessary when loading an extension in |
42 // incognito. The goal is to load the extension, enable incognito, then wait | 42 // incognito. The goal is to load the extension, enable incognito, then wait |
43 // for both background pages to load and close. The problem is that enabling | 43 // for both background pages to load and close. The problem is that enabling |
44 // incognito involves reloading the extension - and the background pages may | 44 // incognito involves reloading the extension - and the background pages may |
45 // have already loaded once before then. So we wait until the extension is | 45 // have already loaded once before then. So we wait until the extension is |
46 // unloaded before listening to the background page notifications. | 46 // unloaded before listening to the background page notifications. |
47 class LoadedIncognitoObserver : public content::NotificationObserver { | 47 class LoadedIncognitoObserver : public content::NotificationObserver { |
48 public: | 48 public: |
49 explicit LoadedIncognitoObserver(Profile* profile) : profile_(profile) { | 49 explicit LoadedIncognitoObserver(Profile* profile) : profile_(profile) { |
50 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 50 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
51 content::Source<Profile>(profile)); | 51 content::Source<Profile>(profile)); |
52 } | 52 } |
53 | 53 |
54 void Wait() { | 54 void Wait() { |
55 ASSERT_TRUE(original_complete_.get()); | 55 ASSERT_TRUE(original_complete_.get()); |
56 original_complete_->Wait(); | 56 original_complete_->Wait(); |
57 incognito_complete_->Wait(); | 57 incognito_complete_->Wait(); |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 | 567 |
568 // Tests that the lazy background page will be unloaded if the onSuspend event | 568 // Tests that the lazy background page will be unloaded if the onSuspend event |
569 // handler calls an API function such as chrome.storage.local.set(). | 569 // handler calls an API function such as chrome.storage.local.set(). |
570 // See: http://crbug.com/296834 | 570 // See: http://crbug.com/296834 |
571 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { | 571 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { |
572 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); | 572 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); |
573 } | 573 } |
574 | 574 |
575 // TODO: background page with timer. | 575 // TODO: background page with timer. |
576 // TODO: background page that interacts with popup. | 576 // TODO: background page that interacts with popup. |
OLD | NEW |