| 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(value); |
| 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 return status; | 868 return status; |
| 865 } | 869 } |
| 866 | 870 |
| 867 Status ExecuteTakeHeapSnapshot( | 871 Status ExecuteTakeHeapSnapshot( |
| 868 Session* session, | 872 Session* session, |
| 869 WebView* web_view, | 873 WebView* web_view, |
| 870 const base::DictionaryValue& params, | 874 const base::DictionaryValue& params, |
| 871 scoped_ptr<base::Value>* value) { | 875 scoped_ptr<base::Value>* value) { |
| 872 return web_view->TakeHeapSnapshot(value); | 876 return web_view->TakeHeapSnapshot(value); |
| 873 } | 877 } |
| OLD | NEW |