Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: chrome/browser/extensions/lazy_background_page_apitest.cc

Issue 688853005: Consolidate javascript_dialog_manager.h and javascript_dialog_manager_impl.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/scoped_observer.h" 6 #include "base/scoped_observer.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 8 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
9 #include "chrome/browser/extensions/browser_action_test_util.h" 9 #include "chrome/browser/extensions/browser_action_test_util.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 // Tests that a JavaScript alert keeps the lazy background page alive. 210 // Tests that a JavaScript alert keeps the lazy background page alive.
211 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForDialog) { 211 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForDialog) {
212 LazyBackgroundObserver background_observer; 212 LazyBackgroundObserver background_observer;
213 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). 213 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page").
214 AppendASCII("wait_for_dialog"); 214 AppendASCII("wait_for_dialog");
215 const Extension* extension = LoadExtension(extdir); 215 const Extension* extension = LoadExtension(extdir);
216 ASSERT_TRUE(extension); 216 ASSERT_TRUE(extension);
217 217
218 // The test extension opens a dialog on installation. 218 // The test extension opens a dialog on installation.
219 AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog(); 219 app_modal::AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog();
220 ASSERT_TRUE(dialog); 220 ASSERT_TRUE(dialog);
221 221
222 // With the dialog open the background page is still alive. 222 // With the dialog open the background page is still alive.
223 EXPECT_TRUE(IsBackgroundPageAlive(extension->id())); 223 EXPECT_TRUE(IsBackgroundPageAlive(extension->id()));
224 224
225 // Close the dialog. The keep alive count is decremented. 225 // Close the dialog. The keep alive count is decremented.
226 extensions::ProcessManager* pm = 226 extensions::ProcessManager* pm =
227 extensions::ProcessManager::Get(browser()->profile()); 227 extensions::ProcessManager::Get(browser()->profile());
228 int previous_keep_alive_count = pm->GetLazyKeepaliveCount(extension); 228 int previous_keep_alive_count = pm->GetLazyKeepaliveCount(extension);
229 dialog->CloseModalDialog(); 229 dialog->CloseModalDialog();
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 560
561 // Tests that the lazy background page will be unloaded if the onSuspend event 561 // Tests that the lazy background page will be unloaded if the onSuspend event
562 // handler calls an API function such as chrome.storage.local.set(). 562 // handler calls an API function such as chrome.storage.local.set().
563 // See: http://crbug.com/296834 563 // See: http://crbug.com/296834
564 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { 564 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) {
565 EXPECT_TRUE(LoadExtensionAndWait("on_suspend")); 565 EXPECT_TRUE(LoadExtensionAndWait("on_suspend"));
566 } 566 }
567 567
568 // TODO: background page with timer. 568 // TODO: background page with timer.
569 // TODO: background page that interacts with popup. 569 // TODO: background page that interacts with popup.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698