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

Side by Side Diff: content/test/content_browser_test_utils_internal.cc

Issue 715203004: PlzNavigate: Add a browser test for basic navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a browser test for renderer initiated navigations Created 6 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/test/content_browser_test_utils_internal.h" 5 #include "content/test/content_browser_test_utils_internal.h"
6 6
7 #include "content/browser/frame_host/frame_tree_node.h" 7 #include "content/browser/frame_host/frame_tree_node.h"
8 #include "content/browser/frame_host/navigator.h" 8 #include "content/browser/frame_host/navigator.h"
9 #include "content/test/test_frame_navigation_observer.h" 9 #include "content/test/test_frame_navigation_observer.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 TestNavigationWebContentsObserver::TestNavigationWebContentsObserver(
15 WebContents* web_contents)
16 : WebContentsObserver(web_contents), navigation_succeeded_(false) {
17 }
18
19 TestNavigationWebContentsObserver::~TestNavigationWebContentsObserver() {
20 }
21
22 void TestNavigationWebContentsObserver::DidStartProvisionalLoadForFrame(
23 RenderFrameHost* render_frame_host,
24 const GURL& validated_url,
25 bool is_error_page,
26 bool is_iframe_srcdoc) {
27 navigation_succeeded_ = false;
28 }
29
30 void TestNavigationWebContentsObserver::DidFailProvisionalLoad(
31 RenderFrameHost* render_frame_host,
32 const GURL& validated_url,
33 int error_code,
34 const base::string16& error_description) {
35 navigation_url_ = validated_url;
36 navigation_succeeded_ = false;
37 }
38
39 void TestNavigationWebContentsObserver::DidCommitProvisionalLoadForFrame(
40 RenderFrameHost* render_frame_host,
41 const GURL& url,
42 ui::PageTransition transition_type) {
43 navigation_url_ = url;
44 navigation_succeeded_ = true;
45 }
46
14 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url) { 47 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url) {
15 TestFrameNavigationObserver observer(node); 48 TestFrameNavigationObserver observer(node);
16 NavigationController::LoadURLParams params(url); 49 NavigationController::LoadURLParams params(url);
17 params.transition_type = ui::PAGE_TRANSITION_LINK; 50 params.transition_type = ui::PAGE_TRANSITION_LINK;
18 params.frame_tree_node_id = node->frame_tree_node_id(); 51 params.frame_tree_node_id = node->frame_tree_node_id();
19 node->navigator()->GetController()->LoadURLWithParams(params); 52 node->navigator()->GetController()->LoadURLWithParams(params);
20 observer.Wait(); 53 observer.Wait();
21 } 54 }
22 55
23 } // namespace content 56 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698