| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/google/google_util.h" | 7 #include "chrome/browser/google/google_util.h" |
| 8 #include "chrome/browser/net/url_request_mock_util.h" | 8 #include "chrome/browser/net/url_request_mock_util.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 base::FilePath(FILE_PATH_LITERAL("page404.html"))), | 248 base::FilePath(FILE_PATH_LITERAL("page404.html"))), |
| 249 "SUCCESS", | 249 "SUCCESS", |
| 250 1); | 250 1); |
| 251 } | 251 } |
| 252 | 252 |
| 253 // Protocol handler that fails all requests with net::ERR_ADDRESS_UNREACHABLE. | 253 // Protocol handler that fails all requests with net::ERR_ADDRESS_UNREACHABLE. |
| 254 class AddressUnreachableProtocolHandler | 254 class AddressUnreachableProtocolHandler |
| 255 : public net::URLRequestJobFactory::ProtocolHandler { | 255 : public net::URLRequestJobFactory::ProtocolHandler { |
| 256 public: | 256 public: |
| 257 AddressUnreachableProtocolHandler() {} | 257 AddressUnreachableProtocolHandler() {} |
| 258 ~AddressUnreachableProtocolHandler() {} | 258 virtual ~AddressUnreachableProtocolHandler() {} |
| 259 | 259 |
| 260 // net::URLRequestJobFactory::ProtocolHandler: | 260 // net::URLRequestJobFactory::ProtocolHandler: |
| 261 virtual net::URLRequestJob* MaybeCreateJob( | 261 virtual net::URLRequestJob* MaybeCreateJob( |
| 262 net::URLRequest* request, | 262 net::URLRequest* request, |
| 263 net::NetworkDelegate* network_delegate) const OVERRIDE { | 263 net::NetworkDelegate* network_delegate) const OVERRIDE { |
| 264 return new URLRequestFailedJob(request, | 264 return new URLRequestFailedJob(request, |
| 265 network_delegate, | 265 network_delegate, |
| 266 net::ERR_ADDRESS_UNREACHABLE); | 266 net::ERR_ADDRESS_UNREACHABLE); |
| 267 } | 267 } |
| 268 | 268 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 326 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 327 browser()->tab_strip_model()->GetActiveWebContents(), | 327 browser()->tab_strip_model()->GetActiveWebContents(), |
| 328 "var textContent = document.body.textContent;" | 328 "var textContent = document.body.textContent;" |
| 329 "var hasError = textContent.indexOf('ERR_NAME_NOT_RESOLVED') >= 0;" | 329 "var hasError = textContent.indexOf('ERR_NAME_NOT_RESOLVED') >= 0;" |
| 330 "domAutomationController.send(hasError);", | 330 "domAutomationController.send(hasError);", |
| 331 &result)); | 331 &result)); |
| 332 EXPECT_TRUE(result); | 332 EXPECT_TRUE(result); |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace | 335 } // namespace |
| OLD | NEW |