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

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

Issue 23475011: Revert 220623 "Update chrome://newtab checks in browser tests to..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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_utils.h" 10 #include "chrome/browser/bookmarks/bookmark_utils.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/extensions/browser_action_test_util.h" 12 #include "chrome/browser/extensions/browser_action_test_util.h"
13 #include "chrome/browser/extensions/extension_apitest.h" 13 #include "chrome/browser/extensions/extension_apitest.h"
14 #include "chrome/browser/extensions/extension_host.h" 14 #include "chrome/browser/extensions/extension_host.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/extension_system.h" 16 #include "chrome/browser/extensions/extension_system.h"
17 #include "chrome/browser/extensions/extension_test_message_listener.h" 17 #include "chrome/browser/extensions/extension_test_message_listener.h"
18 #include "chrome/browser/extensions/lazy_background_page_test_util.h" 18 #include "chrome/browser/extensions/lazy_background_page_test_util.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/search/search.h"
21 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/browser/ui/omnibox/location_bar.h" 22 #include "chrome/browser/ui/omnibox/location_bar.h"
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" 23 #include "chrome/browser/ui/tabs/tab_strip_model.h"
25 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/extensions/extension.h" 25 #include "chrome/common/extensions/extension.h"
27 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
28 #include "chrome/test/base/ui_test_utils.h" 27 #include "chrome/test/base/ui_test_utils.h"
29 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
30 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, MAYBE_WaitForNTP) { 274 IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, MAYBE_WaitForNTP) {
276 LazyBackgroundObserver lazybg; 275 LazyBackgroundObserver lazybg;
277 ResultCatcher catcher; 276 ResultCatcher catcher;
278 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). 277 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page").
279 AppendASCII("wait_for_ntp"); 278 AppendASCII("wait_for_ntp");
280 const Extension* extension = LoadExtension(extdir); 279 const Extension* extension = LoadExtension(extdir);
281 ASSERT_TRUE(extension); 280 ASSERT_TRUE(extension);
282 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 281 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
283 282
284 // The extension should've opened a new tab to an extension page. 283 // The extension should've opened a new tab to an extension page.
285 EXPECT_TRUE(chrome::IsNTPURL( 284 EXPECT_EQ(std::string(chrome::kChromeUINewTabURL),
286 browser()->tab_strip_model()->GetActiveWebContents()->GetURL(), 285 browser()->tab_strip_model()->GetActiveWebContents()->
287 browser()->profile())); 286 GetURL().spec());
288 287
289 // Lazy Background Page still exists, because the extension created a new tab 288 // Lazy Background Page still exists, because the extension created a new tab
290 // to an extension page. 289 // to an extension page.
291 ExtensionProcessManager* pm = 290 ExtensionProcessManager* pm =
292 extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); 291 extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
293 EXPECT_TRUE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); 292 EXPECT_TRUE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_));
294 293
295 // Navigate away from the NTP, which should close the event page. 294 // Navigate away from the NTP, which should close the event page.
296 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); 295 ui_test_utils::NavigateToURL(browser(), GURL("about:blank"));
297 lazybg.Wait(); 296 lazybg.Wait();
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 "//iframe[starts-with(@src, 'chrome://extension')]", 498 "//iframe[starts-with(@src, 'chrome://extension')]",
500 "var ele = document.querySelectorAll('div.active-views');" 499 "var ele = document.querySelectorAll('div.active-views');"
501 "window.domAutomationController.send(" 500 "window.domAutomationController.send("
502 " ele[0].innerHTML.search('(Inactive)') > 0);", 501 " ele[0].innerHTML.search('(Inactive)') > 0);",
503 &is_inactive)); 502 &is_inactive));
504 EXPECT_TRUE(is_inactive); 503 EXPECT_TRUE(is_inactive);
505 } 504 }
506 505
507 // TODO: background page with timer. 506 // TODO: background page with timer.
508 // TODO: background page that interacts with popup. 507 // TODO: background page that interacts with popup.
OLDNEW
« no previous file with comments | « no previous file | trunk/src/chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698