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/window_commands.h" | 5 #include "chrome/test/chromedriver/window_commands.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 Status ExecuteExecuteScript( | 249 Status ExecuteExecuteScript( |
250 Session* session, | 250 Session* session, |
251 WebView* web_view, | 251 WebView* web_view, |
252 const base::DictionaryValue& params, | 252 const base::DictionaryValue& params, |
253 scoped_ptr<base::Value>* value) { | 253 scoped_ptr<base::Value>* value) { |
254 std::string script; | 254 std::string script; |
255 if (!params.GetString("script", &script)) | 255 if (!params.GetString("script", &script)) |
256 return Status(kUnknownError, "'script' must be a string"); | 256 return Status(kUnknownError, "'script' must be a string"); |
257 if (script == ":takeHeapSnapshot") { | 257 if (script == ":takeHeapSnapshot") { |
258 return web_view->TakeHeapSnapshot(value); | 258 return web_view->TakeHeapSnapshot(value); |
| 259 } else if (script == ":getEventListenersCount") { |
| 260 return web_view->GetEventListenersCount(value); |
259 } else { | 261 } else { |
260 const base::ListValue* args; | 262 const base::ListValue* args; |
261 if (!params.GetList("args", &args)) | 263 if (!params.GetList("args", &args)) |
262 return Status(kUnknownError, "'args' must be a list"); | 264 return Status(kUnknownError, "'args' must be a list"); |
263 | 265 |
264 return web_view->CallFunction(session->GetCurrentFrameId(), | 266 return web_view->CallFunction(session->GetCurrentFrameId(), |
265 "function(){" + script + "}", *args, value); | 267 "function(){" + script + "}", *args, value); |
266 } | 268 } |
267 } | 269 } |
268 | 270 |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 // |accuracy| is not part of the WebDriver spec yet, so if it is not given | 857 // |accuracy| is not part of the WebDriver spec yet, so if it is not given |
856 // default to 100 meters accuracy. | 858 // default to 100 meters accuracy. |
857 geoposition.accuracy = 100; | 859 geoposition.accuracy = 100; |
858 } | 860 } |
859 | 861 |
860 Status status = web_view->OverrideGeolocation(geoposition); | 862 Status status = web_view->OverrideGeolocation(geoposition); |
861 if (status.IsOk()) | 863 if (status.IsOk()) |
862 session->overridden_geoposition.reset(new Geoposition(geoposition)); | 864 session->overridden_geoposition.reset(new Geoposition(geoposition)); |
863 return status; | 865 return status; |
864 } | 866 } |
OLD | NEW |