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

Side by Side Diff: content/public/test/test_navigation_observer.cc

Issue 2913733002: Add a browser test for access control for file: scheme (Closed)
Patch Set: just rebase Created 3 years, 6 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
« no previous file with comments | « content/public/test/test_navigation_observer.h ('k') | no next file » | 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 "content/public/test/test_navigation_observer.h" 5 #include "content/public/test/test_navigation_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/browser/navigation_handle.h" 10 #include "content/public/browser/navigation_handle.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return; 49 return;
50 50
51 parent_->OnDidStartNavigation(); 51 parent_->OnDidStartNavigation();
52 } 52 }
53 53
54 void DidFinishNavigation(NavigationHandle* navigation_handle) override { 54 void DidFinishNavigation(NavigationHandle* navigation_handle) override {
55 if (!navigation_handle->HasCommitted()) 55 if (!navigation_handle->HasCommitted())
56 return; 56 return;
57 57
58 parent_->OnDidFinishNavigation(navigation_handle->IsErrorPage(), 58 parent_->OnDidFinishNavigation(navigation_handle->IsErrorPage(),
59 navigation_handle->GetURL()); 59 navigation_handle->GetURL(),
60 navigation_handle->GetNetErrorCode());
60 } 61 }
61 62
62 TestNavigationObserver* parent_; 63 TestNavigationObserver* parent_;
63 64
64 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver); 65 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver);
65 }; 66 };
66 67
67 TestNavigationObserver::TestNavigationObserver( 68 TestNavigationObserver::TestNavigationObserver(
68 WebContents* web_contents, 69 WebContents* web_contents,
69 int number_of_navigations, 70 int number_of_navigations,
70 MessageLoopRunner::QuitMode quit_mode) 71 MessageLoopRunner::QuitMode quit_mode)
71 : navigation_started_(false), 72 : navigation_started_(false),
72 navigations_completed_(0), 73 navigations_completed_(0),
73 number_of_navigations_(number_of_navigations), 74 number_of_navigations_(number_of_navigations),
74 last_navigation_succeeded_(false), 75 last_navigation_succeeded_(false),
76 last_net_error_code_(net::OK),
75 message_loop_runner_(new MessageLoopRunner(quit_mode)), 77 message_loop_runner_(new MessageLoopRunner(quit_mode)),
76 web_contents_created_callback_( 78 web_contents_created_callback_(
77 base::Bind(&TestNavigationObserver::OnWebContentsCreated, 79 base::Bind(&TestNavigationObserver::OnWebContentsCreated,
78 base::Unretained(this))) { 80 base::Unretained(this))) {
79 if (web_contents) 81 if (web_contents)
80 RegisterAsObserver(web_contents); 82 RegisterAsObserver(web_contents);
81 } 83 }
82 84
83 TestNavigationObserver::TestNavigationObserver( 85 TestNavigationObserver::TestNavigationObserver(
84 WebContents* web_contents, 86 WebContents* web_contents,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 navigation_started_ = false; 151 navigation_started_ = false;
150 message_loop_runner_->Quit(); 152 message_loop_runner_->Quit();
151 } 153 }
152 } 154 }
153 155
154 void TestNavigationObserver::OnDidStartNavigation() { 156 void TestNavigationObserver::OnDidStartNavigation() {
155 last_navigation_succeeded_ = false; 157 last_navigation_succeeded_ = false;
156 } 158 }
157 159
158 void TestNavigationObserver::OnDidFinishNavigation(bool is_error_page, 160 void TestNavigationObserver::OnDidFinishNavigation(bool is_error_page,
159 const GURL& url) { 161 const GURL& url,
162 net::Error error_code) {
160 last_navigation_url_ = url; 163 last_navigation_url_ = url;
161 last_navigation_succeeded_ = !is_error_page; 164 last_navigation_succeeded_ = !is_error_page;
165 last_net_error_code_ = error_code;
162 } 166 }
163 167
164 } // namespace content 168 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/test_navigation_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698