| OLD | NEW |
| 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/test/render_view_test.h" | 5 #include "content/test/render_view_test.h" |
| 6 | 6 |
| 7 #include "content/common/dom_storage_common.h" | 7 #include "content/common/dom_storage_common.h" |
| 8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
| 9 #include "content/public/browser/native_web_keyboard_event.h" | 9 #include "content/public/browser/native_web_keyboard_event.h" |
| 10 #include "content/public/common/renderer_preferences.h" | 10 #include "content/public/common/renderer_preferences.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 | 324 |
| 325 void RenderViewTest::SendWebKeyboardEvent( | 325 void RenderViewTest::SendWebKeyboardEvent( |
| 326 const WebKit::WebKeyboardEvent& key_event) { | 326 const WebKit::WebKeyboardEvent& key_event) { |
| 327 scoped_ptr<IPC::Message> input_message(new ViewMsg_HandleInputEvent(0)); | 327 scoped_ptr<IPC::Message> input_message(new ViewMsg_HandleInputEvent(0)); |
| 328 input_message->WriteData(reinterpret_cast<const char*>(&key_event), | 328 input_message->WriteData(reinterpret_cast<const char*>(&key_event), |
| 329 sizeof(WebKit::WebKeyboardEvent)); | 329 sizeof(WebKit::WebKeyboardEvent)); |
| 330 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 330 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 331 impl->OnMessageReceived(*input_message); | 331 impl->OnMessageReceived(*input_message); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void RenderViewTest::SendWebMouseEvent( |
| 335 const WebKit::WebMouseEvent& mouse_event) { |
| 336 scoped_ptr<IPC::Message> input_message(new ViewMsg_HandleInputEvent(0)); |
| 337 input_message->WriteData(reinterpret_cast<const char*>(&mouse_event), |
| 338 sizeof(WebKit::WebMouseEvent)); |
| 339 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 340 impl->OnMessageReceived(*input_message); |
| 341 } |
| 342 |
| 334 const char* const kGetCoordinatesScript = | 343 const char* const kGetCoordinatesScript = |
| 335 "(function() {" | 344 "(function() {" |
| 336 " function GetCoordinates(elem) {" | 345 " function GetCoordinates(elem) {" |
| 337 " if (!elem)" | 346 " if (!elem)" |
| 338 " return [ 0, 0];" | 347 " return [ 0, 0];" |
| 339 " var coordinates = [ elem.offsetLeft, elem.offsetTop];" | 348 " var coordinates = [ elem.offsetLeft, elem.offsetTop];" |
| 340 " var parent_coordinates = GetCoordinates(elem.offsetParent);" | 349 " var parent_coordinates = GetCoordinates(elem.offsetParent);" |
| 341 " coordinates[0] += parent_coordinates[0];" | 350 " coordinates[0] += parent_coordinates[0];" |
| 342 " coordinates[1] += parent_coordinates[1];" | 351 " coordinates[1] += parent_coordinates[1];" |
| 343 " return coordinates;" | 352 " return coordinates;" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 439 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 431 impl->set_send_content_state_immediately(true); | 440 impl->set_send_content_state_immediately(true); |
| 432 } | 441 } |
| 433 | 442 |
| 434 WebKit::WebWidget* RenderViewTest::GetWebWidget() { | 443 WebKit::WebWidget* RenderViewTest::GetWebWidget() { |
| 435 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 444 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 436 return impl->webwidget(); | 445 return impl->webwidget(); |
| 437 } | 446 } |
| 438 | 447 |
| 439 } // namespace content | 448 } // namespace content |
| OLD | NEW |