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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 Status ExecuteExecuteScript( | 250 Status ExecuteExecuteScript( |
251 Session* session, | 251 Session* session, |
252 WebView* web_view, | 252 WebView* web_view, |
253 const base::DictionaryValue& params, | 253 const base::DictionaryValue& params, |
254 scoped_ptr<base::Value>* value) { | 254 scoped_ptr<base::Value>* value) { |
255 std::string script; | 255 std::string script; |
256 if (!params.GetString("script", &script)) | 256 if (!params.GetString("script", &script)) |
257 return Status(kUnknownError, "'script' must be a string"); | 257 return Status(kUnknownError, "'script' must be a string"); |
258 if (script == ":takeHeapSnapshot") { | 258 if (script == ":takeHeapSnapshot") { |
259 return web_view->TakeHeapSnapshot(value); | 259 return web_view->TakeHeapSnapshot(value); |
| 260 } else if (script == ":startProfile") { |
| 261 return web_view->StartProfile(); |
| 262 } else if (script == ":endProfile") { |
| 263 return web_view->EndProfile(value); |
260 } else { | 264 } else { |
261 const base::ListValue* args; | 265 const base::ListValue* args; |
262 if (!params.GetList("args", &args)) | 266 if (!params.GetList("args", &args)) |
263 return Status(kUnknownError, "'args' must be a list"); | 267 return Status(kUnknownError, "'args' must be a list"); |
264 | 268 |
265 return web_view->CallFunction(session->GetCurrentFrameId(), | 269 return web_view->CallFunction(session->GetCurrentFrameId(), |
266 "function(){" + script + "}", *args, value); | 270 "function(){" + script + "}", *args, value); |
267 } | 271 } |
268 } | 272 } |
269 | 273 |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 return status; | 877 return status; |
874 } | 878 } |
875 | 879 |
876 Status ExecuteTakeHeapSnapshot( | 880 Status ExecuteTakeHeapSnapshot( |
877 Session* session, | 881 Session* session, |
878 WebView* web_view, | 882 WebView* web_view, |
879 const base::DictionaryValue& params, | 883 const base::DictionaryValue& params, |
880 scoped_ptr<base::Value>* value) { | 884 scoped_ptr<base::Value>* value) { |
881 return web_view->TakeHeapSnapshot(value); | 885 return web_view->TakeHeapSnapshot(value); |
882 } | 886 } |
OLD | NEW |