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

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

Issue 4291001: Convert implicit scoped_refptr constructor calls to explicit ones, part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/build
Patch Set: comments Created 10 years, 1 month 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
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | ipc/ipc_channel_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_element_proxy.h" 5 #include "chrome/test/automation/dom_element_proxy.h"
6 6
7 #include "chrome/test/automation/javascript_execution_controller.h" 7 #include "chrome/test/automation/javascript_execution_controller.h"
8 #include "chrome/test/automation/javascript_message_utils.h" 8 #include "chrome/test/automation/javascript_message_utils.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return false; 102 return false;
103 103
104 const char* script = "domAutomation.findElements(" 104 const char* script = "domAutomation.findElements("
105 "domAutomation.getObject(%s), %s);"; 105 "domAutomation.getObject(%s), %s);";
106 std::vector<int> element_handles; 106 std::vector<int> element_handles;
107 if (!executor_->ExecuteJavaScriptAndGetReturn( 107 if (!executor_->ExecuteJavaScriptAndGetReturn(
108 JavaScriptPrintf(script, this->handle(), by), &element_handles)) { 108 JavaScriptPrintf(script, this->handle(), by), &element_handles)) {
109 return false; 109 return false;
110 } 110 }
111 for (size_t i = 0; i < element_handles.size(); i++) { 111 for (size_t i = 0; i < element_handles.size(); i++) {
112 elements->push_back(executor_->GetObjectProxy<DOMElementProxy>( 112 elements->push_back(make_scoped_refptr(
113 element_handles[i])); 113 executor_->GetObjectProxy<DOMElementProxy>(element_handles[i])));
114 } 114 }
115 return true; 115 return true;
116 } 116 }
117 117
118 bool DOMElementProxy::WaitForVisibleElementCount( 118 bool DOMElementProxy::WaitForVisibleElementCount(
119 const By& by, int count, std::vector<DOMElementProxyRef>* elements) { 119 const By& by, int count, std::vector<DOMElementProxyRef>* elements) {
120 if (!elements) { 120 if (!elements) {
121 NOTREACHED(); 121 NOTREACHED();
122 return false; 122 return false;
123 } 123 }
124 if (!is_valid()) 124 if (!is_valid())
125 return false; 125 return false;
126 126
127 const char* script = "domAutomation.waitForVisibleElementCount(" 127 const char* script = "domAutomation.waitForVisibleElementCount("
128 "domAutomation.getObject(%s), %s, %s," 128 "domAutomation.getObject(%s), %s, %s,"
129 "domAutomation.getCallId());"; 129 "domAutomation.getCallId());";
130 std::vector<int> element_handles; 130 std::vector<int> element_handles;
131 if (!executor_->ExecuteAsyncJavaScriptAndGetReturn( 131 if (!executor_->ExecuteAsyncJavaScriptAndGetReturn(
132 JavaScriptPrintf(script, this->handle(), by, count), &element_handles)) { 132 JavaScriptPrintf(script, this->handle(), by, count), &element_handles)) {
133 return false; 133 return false;
134 } 134 }
135 if (static_cast<int>(element_handles.size()) == count) { 135 if (static_cast<int>(element_handles.size()) == count) {
136 for (size_t i = 0; i < element_handles.size(); i++) { 136 for (size_t i = 0; i < element_handles.size(); i++) {
137 elements->push_back(executor_->GetObjectProxy<DOMElementProxy>( 137 elements->push_back(make_scoped_refptr(
138 element_handles[i])); 138 executor_->GetObjectProxy<DOMElementProxy>(element_handles[i])));
139 } 139 }
140 } 140 }
141 return static_cast<int>(element_handles.size()) == count; 141 return static_cast<int>(element_handles.size()) == count;
142 } 142 }
143 143
144 DOMElementProxyRef DOMElementProxy::WaitFor1VisibleElement(const By& by) { 144 DOMElementProxyRef DOMElementProxy::WaitFor1VisibleElement(const By& by) {
145 std::vector<DOMElementProxyRef> elements; 145 std::vector<DOMElementProxyRef> elements;
146 if (!WaitForVisibleElementCount(by, 1, &elements)) 146 if (!WaitForVisibleElementCount(by, 1, &elements))
147 return NULL; 147 return NULL;
148 return elements[0]; 148 return elements[0];
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 return false; 289 return false;
290 } 290 }
291 if (!is_valid()) 291 if (!is_valid())
292 return false; 292 return false;
293 293
294 const char* script = "domAutomation.getValue(" 294 const char* script = "domAutomation.getValue("
295 "domAutomation.getObject(%s), %s);"; 295 "domAutomation.getObject(%s), %s);";
296 return executor_->ExecuteJavaScriptAndGetReturn( 296 return executor_->ExecuteJavaScriptAndGetReturn(
297 JavaScriptPrintf(script, this->handle(), type), value); 297 JavaScriptPrintf(script, this->handle(), type), value);
298 } 298 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | ipc/ipc_channel_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698