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: content/browser/webui/url_data_manager_backend_unittest.cc

Issue 1421743002: Implement chrome://network-errors for direct access to network error interstitials (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 5 years, 1 month 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/browser/webui/url_data_manager_backend.cc ('k') | content/content_browser.gypi » ('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 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/browser/webui/url_data_manager_backend.h" 7 #include "content/browser/webui/url_data_manager_backend.h"
8 #include "content/public/test/mock_resource_context.h" 8 #include "content/public/test/mock_resource_context.h"
9 #include "content/public/test/test_browser_thread_bundle.h" 9 #include "content/public/test/test_browser_thread_bundle.h"
10 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 scoped_ptr<net::URLRequest> request( 100 scoped_ptr<net::URLRequest> request(
101 CreateRequest(&cancel_delegate, "chrome://webui")); 101 CreateRequest(&cancel_delegate, "chrome://webui"));
102 request->Start(); 102 request->Start();
103 base::RunLoop().RunUntilIdle(); 103 base::RunLoop().RunUntilIdle();
104 104
105 EXPECT_EQ(net::URLRequestStatus::CANCELED, request->status().status()); 105 EXPECT_EQ(net::URLRequestStatus::CANCELED, request->status().status());
106 EXPECT_EQ(1, cancel_delegate.response_started_count()); 106 EXPECT_EQ(1, cancel_delegate.response_started_count());
107 EXPECT_EQ("", cancel_delegate.data_received()); 107 EXPECT_EQ("", cancel_delegate.data_received());
108 } 108 }
109 109
110 // Check network error requests via chrome://network-error/.
111 TEST_F(UrlDataManagerBackendTest, ChromeNetworkErrorPageRequest) {
112 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest(
113 GURL("chrome://network-errors"), net::HIGHEST, &delegate_);
114 request->Start();
115 base::RunLoop().RunUntilIdle();
mmenke 2015/11/17 22:25:49 Run() (The delegate exits the message loop when ne
edwardjung 2015/11/19 13:43:29 Thanks. Fixed.
116 EXPECT_TRUE(request->status().is_success());
117 EXPECT_TRUE(request->status().is_io_pending());
118 EXPECT_EQ(request->status().error(), net::OK);
119 EXPECT_EQ(request->status().status(), net::URLRequestStatus::SUCCESS);
120 EXPECT_NE(delegate_.data_received(), "");
121
122 scoped_ptr<net::URLRequest> error_request =
mmenke 2015/11/17 22:25:50 Suggest just moving this into a separate test. Fe
edwardjung 2015/11/19 13:43:29 Done.
123 url_request_context_.CreateRequest(
124 GURL("chrome://network-errors/-105"), net::HIGHEST, &delegate_);
125 request->Start();
126 base::RunLoop().RunUntilIdle();
mmenke 2015/11/17 22:25:49 Run()
edwardjung 2015/11/19 13:43:29 Done.
127 EXPECT_EQ(request->status().status(), net::URLRequestStatus::FAILED);
128 EXPECT_EQ(request->status().error(), net::ERR_NAME_NOT_RESOLVED);
129 }
130
mmenke 2015/11/17 22:25:49 Add a test with a URL with an invalid error code?
edwardjung 2015/11/19 13:43:29 Done.
110 } // namespace content 131 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/url_data_manager_backend.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698