OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/test/chromedriver/chrome/web_view_impl.h" | 5 #include "chrome/test/chromedriver/chrome/web_view_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return client_->ConnectIfNecessary(); | 148 return client_->ConnectIfNecessary(); |
149 } | 149 } |
150 | 150 |
151 Status WebViewImpl::HandleReceivedEvents() { | 151 Status WebViewImpl::HandleReceivedEvents() { |
152 return client_->HandleReceivedEvents(); | 152 return client_->HandleReceivedEvents(); |
153 } | 153 } |
154 | 154 |
155 Status WebViewImpl::Load(const std::string& url) { | 155 Status WebViewImpl::Load(const std::string& url) { |
156 // Javascript URLs will cause a hang while waiting for the page to stop | 156 // Javascript URLs will cause a hang while waiting for the page to stop |
157 // loading, so just disallow. | 157 // loading, so just disallow. |
158 if (base::StartsWithASCII(url, "javascript:", false)) | 158 if (base::StartsWith(url, "javascript:", |
| 159 base::CompareCase::INSENSITIVE_ASCII)) |
159 return Status(kUnknownError, "unsupported protocol"); | 160 return Status(kUnknownError, "unsupported protocol"); |
160 base::DictionaryValue params; | 161 base::DictionaryValue params; |
161 params.SetString("url", url); | 162 params.SetString("url", url); |
162 return client_->SendCommand("Page.navigate", params); | 163 return client_->SendCommand("Page.navigate", params); |
163 } | 164 } |
164 | 165 |
165 Status WebViewImpl::Reload() { | 166 Status WebViewImpl::Reload() { |
166 base::DictionaryValue params; | 167 base::DictionaryValue params; |
167 params.SetBoolean("ignoreCache", false); | 168 params.SetBoolean("ignoreCache", false); |
168 return client_->SendCommand("Page.reload", params); | 169 return client_->SendCommand("Page.reload", params); |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 if (status.IsError()) | 825 if (status.IsError()) |
825 return status; | 826 return status; |
826 | 827 |
827 if (!cmd_result->GetInteger("nodeId", node_id)) | 828 if (!cmd_result->GetInteger("nodeId", node_id)) |
828 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); | 829 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); |
829 *found_node = true; | 830 *found_node = true; |
830 return Status(kOk); | 831 return Status(kOk); |
831 } | 832 } |
832 | 833 |
833 } // namespace internal | 834 } // namespace internal |
OLD | NEW |