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

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « chrome/browser/prefs/pref_service.cc ('k') | chrome/browser/prerender/prerender_contents.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <deque> 5 #include <deque>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
33 #include "chrome/test/base/in_process_browser_test.h" 33 #include "chrome/test/base/in_process_browser_test.h"
34 #include "chrome/test/base/ui_test_utils.h" 34 #include "chrome/test/base/ui_test_utils.h"
35 #include "content/browser/debugger/devtools_client_host.h" 35 #include "content/browser/debugger/devtools_client_host.h"
36 #include "content/browser/debugger/devtools_manager.h" 36 #include "content/browser/debugger/devtools_manager.h"
37 #include "content/browser/renderer_host/render_view_host.h" 37 #include "content/browser/renderer_host/render_view_host.h"
38 #include "content/browser/tab_contents/tab_contents.h" 38 #include "content/browser/tab_contents/tab_contents.h"
39 #include "content/common/notification_service.h" 39 #include "content/public/browser/notification_service.h"
40 #include "content/public/common/url_constants.h" 40 #include "content/public/common/url_constants.h"
41 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
42 #include "net/base/mock_host_resolver.h" 42 #include "net/base/mock_host_resolver.h"
43 #include "net/url_request/url_request_context.h" 43 #include "net/url_request/url_request_context.h"
44 #include "net/url_request/url_request_context_getter.h" 44 #include "net/url_request/url_request_context_getter.h"
45 #include "ui/base/l10n/l10n_util.h" 45 #include "ui/base/l10n/l10n_util.h"
46 46
47 // Prerender tests work as follows: 47 // Prerender tests work as follows:
48 // 48 //
49 // A page with a prefetch link to the test page is loaded. Once prerendered, 49 // A page with a prefetch link to the test page is loaded. Once prerendered,
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 #endif 521 #endif
522 } 522 }
523 523
524 void OpenDestURLViaWindowOpen() const { 524 void OpenDestURLViaWindowOpen() const {
525 OpenDestURLWithJSImpl("WindowOpen()"); 525 OpenDestURLWithJSImpl("WindowOpen()");
526 } 526 }
527 527
528 void ClickToNextPageAfterPrerender(Browser* browser) { 528 void ClickToNextPageAfterPrerender(Browser* browser) {
529 ui_test_utils::WindowedNotificationObserver new_page_observer( 529 ui_test_utils::WindowedNotificationObserver new_page_observer(
530 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 530 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
531 NotificationService::AllSources()); 531 content::NotificationService::AllSources());
532 RenderViewHost* render_view_host = 532 RenderViewHost* render_view_host =
533 browser->GetSelectedTabContents()->render_view_host(); 533 browser->GetSelectedTabContents()->render_view_host();
534 render_view_host->ExecuteJavascriptInWebFrame( 534 render_view_host->ExecuteJavascriptInWebFrame(
535 string16(), 535 string16(),
536 ASCIIToUTF16("ClickOpenLink()")); 536 ASCIIToUTF16("ClickOpenLink()"));
537 new_page_observer.Wait(); 537 new_page_observer.Wait();
538 } 538 }
539 539
540 void NavigateToNextPageAfterPrerender(Browser* browser) { 540 void NavigateToNextPageAfterPrerender(Browser* browser) {
541 ui_test_utils::NavigateToURL( 541 ui_test_utils::NavigateToURL(
542 browser, 542 browser,
543 test_server()->GetURL("files/prerender/prerender_page.html")); 543 test_server()->GetURL("files/prerender/prerender_page.html"));
544 } 544 }
545 545
546 // Called after the prerendered page has been navigated to and then away from. 546 // Called after the prerendered page has been navigated to and then away from.
547 // Navigates back through the history to the prerendered page. 547 // Navigates back through the history to the prerendered page.
548 void GoBackToPrerender(Browser* browser) { 548 void GoBackToPrerender(Browser* browser) {
549 ui_test_utils::WindowedNotificationObserver back_nav_observer( 549 ui_test_utils::WindowedNotificationObserver back_nav_observer(
550 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 550 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
551 NotificationService::AllSources()); 551 content::NotificationService::AllSources());
552 browser->GoBack(CURRENT_TAB); 552 browser->GoBack(CURRENT_TAB);
553 back_nav_observer.Wait(); 553 back_nav_observer.Wait();
554 bool original_prerender_page = false; 554 bool original_prerender_page = false;
555 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( 555 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
556 browser->GetSelectedTabContents()->render_view_host(), L"", 556 browser->GetSelectedTabContents()->render_view_host(), L"",
557 L"window.domAutomationController.send(IsOriginalPrerenderPage())", 557 L"window.domAutomationController.send(IsOriginalPrerenderPage())",
558 &original_prerender_page)); 558 &original_prerender_page));
559 EXPECT_TRUE(original_prerender_page); 559 EXPECT_TRUE(original_prerender_page);
560 } 560 }
561 561
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 RenderViewHost* inspected_rvh = tab_contents->render_view_host(); 1914 RenderViewHost* inspected_rvh = tab_contents->render_view_host();
1915 DevToolsManager* manager = DevToolsManager::GetInstance(); 1915 DevToolsManager* manager = DevToolsManager::GetInstance();
1916 FakeDevToolsClientHost client_host; 1916 FakeDevToolsClientHost client_host;
1917 manager->RegisterDevToolsClientHostFor(inspected_rvh, &client_host); 1917 manager->RegisterDevToolsClientHostFor(inspected_rvh, &client_host);
1918 const char* url = "files/prerender/prerender_page.html"; 1918 const char* url = "files/prerender/prerender_page.html";
1919 PrerenderTestURL(url, FINAL_STATUS_DEVTOOLS_ATTACHED, 1); 1919 PrerenderTestURL(url, FINAL_STATUS_DEVTOOLS_ATTACHED, 1);
1920 NavigateToURL(url); 1920 NavigateToURL(url);
1921 } 1921 }
1922 1922
1923 } // namespace prerender 1923 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service.cc ('k') | chrome/browser/prerender/prerender_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698