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

Side by Side Diff: content/public/test/render_view_test.cc

Issue 122073003: Track v8 API changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « chrome/test/base/v8_unit_test.cc ('k') | content/renderer/v8_value_converter_impl_unittest.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) 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 "content/public/test/render_view_test.h" 5 #include "content/public/test/render_view_test.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/common/dom_storage/dom_storage_types.h" 8 #include "content/common/dom_storage/dom_storage_types.h"
9 #include "content/common/input_messages.h" 9 #include "content/common/input_messages.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 " bounds[2] = elem.offsetWidth;" 252 " bounds[2] = elem.offsetWidth;"
253 " bounds[3] = elem.offsetHeight;" 253 " bounds[3] = elem.offsetHeight;"
254 " return bounds;" 254 " return bounds;"
255 "})();"; 255 "})();";
256 gfx::Rect RenderViewTest::GetElementBounds(const std::string& element_id) { 256 gfx::Rect RenderViewTest::GetElementBounds(const std::string& element_id) {
257 std::vector<std::string> params; 257 std::vector<std::string> params;
258 params.push_back(element_id); 258 params.push_back(element_id);
259 std::string script = 259 std::string script =
260 ReplaceStringPlaceholders(kGetCoordinatesScript, params, NULL); 260 ReplaceStringPlaceholders(kGetCoordinatesScript, params, NULL);
261 261
262 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 262 v8::Isolate* isolate = v8::Isolate::GetCurrent();
263 v8::HandleScope handle_scope(isolate);
263 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue( 264 v8::Handle<v8::Value> value = GetMainFrame()->executeScriptAndReturnValue(
264 WebScriptSource(WebString::fromUTF8(script))); 265 WebScriptSource(WebString::fromUTF8(script)));
265 if (value.IsEmpty() || !value->IsArray()) 266 if (value.IsEmpty() || !value->IsArray())
266 return gfx::Rect(); 267 return gfx::Rect();
267 268
268 v8::Handle<v8::Array> array = value.As<v8::Array>(); 269 v8::Handle<v8::Array> array = value.As<v8::Array>();
269 if (array->Length() != 4) 270 if (array->Length() != 4)
270 return gfx::Rect(); 271 return gfx::Rect();
271 std::vector<int> coords; 272 std::vector<int> coords;
272 for (int i = 0; i < 4; ++i) { 273 for (int i = 0; i < 4; ++i) {
273 v8::Handle<v8::Number> index = v8::Number::New(i); 274 v8::Handle<v8::Number> index = v8::Number::New(isolate, i);
274 v8::Local<v8::Value> value = array->Get(index); 275 v8::Local<v8::Value> value = array->Get(index);
275 if (value.IsEmpty() || !value->IsInt32()) 276 if (value.IsEmpty() || !value->IsInt32())
276 return gfx::Rect(); 277 return gfx::Rect();
277 coords.push_back(value->Int32Value()); 278 coords.push_back(value->Int32Value());
278 } 279 }
279 return gfx::Rect(coords[0], coords[1], coords[2], coords[3]); 280 return gfx::Rect(coords[0], coords[1], coords[2], coords[3]);
280 } 281 }
281 282
282 bool RenderViewTest::SimulateElementClick(const std::string& element_id) { 283 bool RenderViewTest::SimulateElementClick(const std::string& element_id) {
283 gfx::Rect bounds = GetElementBounds(element_id); 284 gfx::Rect bounds = GetElementBounds(element_id);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 377
377 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); 378 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params);
378 OnMessageReceived(navigate_message); 379 OnMessageReceived(navigate_message);
379 380
380 // The load actually happens asynchronously, so we pump messages to process 381 // The load actually happens asynchronously, so we pump messages to process
381 // the pending continuation. 382 // the pending continuation.
382 ProcessPendingMessages(); 383 ProcessPendingMessages();
383 } 384 }
384 385
385 } // namespace content 386 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/base/v8_unit_test.cc ('k') | content/renderer/v8_value_converter_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698