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

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: Address comments 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
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,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 navigation_started_ = false; 150 navigation_started_ = false;
150 message_loop_runner_->Quit(); 151 message_loop_runner_->Quit();
151 } 152 }
152 } 153 }
153 154
154 void TestNavigationObserver::OnDidStartNavigation() { 155 void TestNavigationObserver::OnDidStartNavigation() {
155 last_navigation_succeeded_ = false; 156 last_navigation_succeeded_ = false;
156 } 157 }
157 158
158 void TestNavigationObserver::OnDidFinishNavigation(bool is_error_page, 159 void TestNavigationObserver::OnDidFinishNavigation(bool is_error_page,
159 const GURL& url) { 160 const GURL& url,
161 net::Error error_code) {
160 last_navigation_url_ = url; 162 last_navigation_url_ = url;
161 last_navigation_succeeded_ = !is_error_page; 163 last_navigation_succeeded_ = !is_error_page;
164 last_net_error_code_ = error_code;
162 } 165 }
163 166
164 } // namespace content 167 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698