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

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: Adding stub, quick code reorg 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::Reload(const Timeout* timeout) { 203 Status WebViewImpl::Reload(const Timeout* timeout) {
204 base::DictionaryValue params; 204 base::DictionaryValue params;
205 params.SetBoolean("ignoreCache", false); 205 params.SetBoolean("ignoreCache", false);
206 return client_->SendCommandWithTimeout("Page.reload", params, timeout); 206 return client_->SendCommandWithTimeout("Page.reload", params, timeout);
207 } 207 }
208 208
209 Status WebViewImpl::SendCommand(const std::string& cmd,
210 const base::DictionaryValue& params) {
211 return client_->SendCommand(cmd, params);
212 }
213
214 Status WebViewImpl::SendCommandAndGetResult(
215 const std::string& cmd,
216 const base::DictionaryValue& params,
217 std::unique_ptr<base::Value>* value) {
218 std::unique_ptr<base::DictionaryValue> result;
219 Status status = client_->SendCommandAndGetResult(cmd, params, &result);
220 if (status.IsError())
221 return status;
222 *value = std::move(result);
223 return Status(kOk);
224 }
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(
213 "Page.getNavigationHistory", params, &result); 230 "Page.getNavigationHistory", params, &result);
214 if (status.IsError()) { 231 if (status.IsError()) {
215 // TODO(samuong): remove this once we stop supporting WebView on KitKat. 232 // TODO(samuong): remove this once we stop supporting WebView on KitKat.
216 // Older versions of WebView on Android (on KitKat and earlier) do not have 233 // Older versions of WebView on Android (on KitKat and earlier) do not have
217 // the Page.getNavigationHistory DevTools command handler, so fall back to 234 // the Page.getNavigationHistory DevTools command handler, so fall back to
218 // using JavaScript to navigate back and forward. WebView reports its build 235 // using JavaScript to navigate back and forward. WebView reports its build
(...skipping 702 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
« no previous file with comments | « chrome/test/chromedriver/chrome/web_view_impl.h ('k') | chrome/test/chromedriver/client/chromedriver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698