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

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

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

Powered by Google App Engine
This is Rietveld 408576698