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

Side by Side Diff: chrome/test/chromedriver/chrome/web_view_impl.cc

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: Indentation and style changes Created 3 years, 7 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) 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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Javascript URLs will cause a hang while waiting for the page to stop 193 // Javascript URLs will cause a hang while waiting for the page to stop
194 // loading, so just disallow. 194 // loading, so just disallow.
195 if (base::StartsWith(url, "javascript:", 195 if (base::StartsWith(url, "javascript:",
196 base::CompareCase::INSENSITIVE_ASCII)) 196 base::CompareCase::INSENSITIVE_ASCII))
197 return Status(kUnknownError, "unsupported protocol"); 197 return Status(kUnknownError, "unsupported protocol");
198 base::DictionaryValue params; 198 base::DictionaryValue params;
199 params.SetString("url", url); 199 params.SetString("url", url);
200 return client_->SendCommandWithTimeout("Page.navigate", params, timeout); 200 return client_->SendCommandWithTimeout("Page.navigate", params, timeout);
201 } 201 }
202 202
203 Status WebViewImpl::SendCommand(const std::string& cmd,
204 const base::DictionaryValue& params) {
205 return client_->SendCommand(cmd, params);
206 }
207
208 Status WebViewImpl::SendCommandAndGetResult(
209 const std::string& cmd,
210 const base::DictionaryValue& params,
211 std::unique_ptr<base::Value>* value) {
212 std::unique_ptr<base::DictionaryValue> result;
213 Status status = client_->SendCommandAndGetResult(cmd, params, &result);
214 if (status.IsError())
215 return status;
216 *value = std::move(result);
217 return Status(kOk);
218 }
219
203 Status WebViewImpl::Reload(const Timeout* timeout) { 220 Status WebViewImpl::Reload(const Timeout* timeout) {
204 base::DictionaryValue params; 221 base::DictionaryValue params;
205 params.SetBoolean("ignoreCache", false); 222 params.SetBoolean("ignoreCache", false);
206 return client_->SendCommandWithTimeout("Page.reload", params, timeout); 223 return client_->SendCommandWithTimeout("Page.reload", params, timeout);
207 } 224 }
208 225
209 Status WebViewImpl::TraverseHistory(int delta, const Timeout* timeout) { 226 Status WebViewImpl::TraverseHistory(int delta, const Timeout* timeout) {
210 base::DictionaryValue params; 227 base::DictionaryValue params;
211 std::unique_ptr<base::DictionaryValue> result; 228 std::unique_ptr<base::DictionaryValue> result;
212 Status status = client_->SendCommandAndGetResult( 229 Status status = client_->SendCommandAndGetResult(
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 938
922 if (!cmd_result->GetInteger("nodeId", node_id)) 939 if (!cmd_result->GetInteger("nodeId", node_id))
923 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); 940 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'");
924 *found_node = true; 941 *found_node = true;
925 return Status(kOk); 942 return Status(kOk);
926 } 943 }
927 944
928 945
929 946
930 } // namespace internal 947 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698