| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/test_runner/web_frame_test_client.h" | 5 #include "components/test_runner/web_frame_test_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 default: | 109 default: |
| 110 return "Unresolved"; | 110 return "Unresolved"; |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 void BlockRequest(blink::WebURLRequest& request) { | 114 void BlockRequest(blink::WebURLRequest& request) { |
| 115 request.setURL(GURL("255.255.255.255")); | 115 request.setURL(GURL("255.255.255.255")); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool IsLocalHost(const std::string& host) { | 118 bool IsLocalHost(const std::string& host) { |
| 119 return host == "127.0.0.1" || host == "localhost"; | 119 return host == "127.0.0.1" || host == "localhost" || host == "[::1]"; |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool IsTestHost(const std::string& host) { | 122 bool IsTestHost(const std::string& host) { |
| 123 return base::EndsWith(host, ".test", base::CompareCase::INSENSITIVE_ASCII); | 123 return base::EndsWith(host, ".test", base::CompareCase::INSENSITIVE_ASCII); |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool HostIsUsedBySomeTestsToGenerateError(const std::string& host) { | 126 bool HostIsUsedBySomeTestsToGenerateError(const std::string& host) { |
| 127 return host == "255.255.255.255"; | 127 return host == "255.255.255.255"; |
| 128 } | 128 } |
| 129 | 129 |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 std::string device_id = sink_id.utf8(); | 762 std::string device_id = sink_id.utf8(); |
| 763 if (device_id == "valid" || device_id.empty()) | 763 if (device_id == "valid" || device_id.empty()) |
| 764 callback->onSuccess(); | 764 callback->onSuccess(); |
| 765 else if (device_id == "unauthorized") | 765 else if (device_id == "unauthorized") |
| 766 callback->onError(blink::WebSetSinkIdError::NotAuthorized); | 766 callback->onError(blink::WebSetSinkIdError::NotAuthorized); |
| 767 else | 767 else |
| 768 callback->onError(blink::WebSetSinkIdError::NotFound); | 768 callback->onError(blink::WebSetSinkIdError::NotFound); |
| 769 } | 769 } |
| 770 | 770 |
| 771 } // namespace test_runner | 771 } // namespace test_runner |
| OLD | NEW |