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

Side by Side Diff: chrome/test/automation/javascript_execution_controller.cc

Issue 10383262: RefCounted types should not have public destructors, delegate cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make win bot happy Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/automation/javascript_execution_controller.h" 5 #include "chrome/test/automation/javascript_execution_controller.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "chrome/test/automation/javascript_message_utils.h" 8 #include "chrome/test/automation/javascript_message_utils.h"
9 9
10 using javascript_utils::JavaScriptPrintf; 10 using javascript_utils::JavaScriptPrintf;
11 11
12 // Initialize this timeout to an invalid value. Each test framework or test 12 // Initialize this timeout to an invalid value. Each test framework or test
13 // must set an appropriate timeout using set_timeout, or the 13 // must set an appropriate timeout using set_timeout, or the
14 // JavaScriptExecutionController will complain. 14 // JavaScriptExecutionController will complain.
15 int JavaScriptExecutionController::timeout_ms_ = -1; 15 int JavaScriptExecutionController::timeout_ms_ = -1;
16 16
17 JavaScriptExecutionController::JavaScriptExecutionController() {} 17 JavaScriptExecutionController::JavaScriptExecutionController() {}
18 18
19 JavaScriptExecutionController::~JavaScriptExecutionController() {}
20
21 bool JavaScriptExecutionController::ExecuteJavaScript( 19 bool JavaScriptExecutionController::ExecuteJavaScript(
22 const std::string& script) { 20 const std::string& script) {
23 scoped_ptr<Value> return_value; 21 scoped_ptr<Value> return_value;
24 return ExecuteAndParseHelper(WrapJavaScript(script), &return_value); 22 return ExecuteAndParseHelper(WrapJavaScript(script), &return_value);
25 } 23 }
26 24
27 bool JavaScriptExecutionController::ExecuteAsyncJavaScript( 25 bool JavaScriptExecutionController::ExecuteAsyncJavaScript(
28 const std::string& script) { 26 const std::string& script) {
29 scoped_ptr<Value> return_value; 27 scoped_ptr<Value> return_value;
30 return ExecuteAndParseHelper(WrapAsyncJavaScript(script), &return_value); 28 return ExecuteAndParseHelper(WrapAsyncJavaScript(script), &return_value);
31 } 29 }
32 30
31 JavaScriptExecutionController::~JavaScriptExecutionController() {}
32
33 void JavaScriptExecutionController::Remove(int handle) { 33 void JavaScriptExecutionController::Remove(int handle) {
34 handle_to_object_.erase(handle); 34 handle_to_object_.erase(handle);
35 if (handle_to_object_.empty()) 35 if (handle_to_object_.empty())
36 LastObjectRemoved(); 36 LastObjectRemoved();
37 } 37 }
38 38
39 std::string JavaScriptExecutionController::WrapJavaScript( 39 std::string JavaScriptExecutionController::WrapJavaScript(
40 const std::string& original_script) { 40 const std::string& original_script) {
41 const char* script = 41 const char* script =
42 "domAutomationController.setAutomationId(0);" 42 "domAutomationController.setAutomationId(0);"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return false; 101 return false;
102 } 102 }
103 if (!success) { 103 if (!success) {
104 LOG(WARNING) << "JavaScript evaluation did not complete successfully: " 104 LOG(WARNING) << "JavaScript evaluation did not complete successfully: "
105 << evaluation_error; 105 << evaluation_error;
106 return false; 106 return false;
107 } 107 }
108 result->reset(evaluation_result_value); 108 result->reset(evaluation_result_value);
109 return true; 109 return true;
110 } 110 }
OLDNEW
« no previous file with comments | « chrome/test/automation/javascript_execution_controller.h ('k') | content/browser/device_orientation/provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698