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/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 | 1290 |
1291 // Note that all coordinates in this test are screen coordinates. | 1291 // Note that all coordinates in this test are screen coordinates. |
1292 view_->SetBounds(gfx::Rect(60, 60, 100, 100)); | 1292 view_->SetBounds(gfx::Rect(60, 60, 100, 100)); |
1293 view_->Show(); | 1293 view_->Show(); |
1294 | 1294 |
1295 aura::test::TestCursorClient cursor_client( | 1295 aura::test::TestCursorClient cursor_client( |
1296 parent_view_->GetNativeView()->GetRootWindow()); | 1296 parent_view_->GetNativeView()->GetRootWindow()); |
1297 | 1297 |
1298 // Cursor is in the middle of the window. | 1298 // Cursor is in the middle of the window. |
1299 cursor_client.reset_calls_to_set_cursor(); | 1299 cursor_client.reset_calls_to_set_cursor(); |
1300 aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(110, 110)); | 1300 aura::Env::GetInstance()->SetLastMouseLocation(gfx::Point(110, 110)); |
1301 view_->UpdateCursorIfOverSelf(); | 1301 view_->UpdateCursorIfOverSelf(); |
1302 EXPECT_EQ(1, cursor_client.calls_to_set_cursor()); | 1302 EXPECT_EQ(1, cursor_client.calls_to_set_cursor()); |
1303 | 1303 |
1304 // Cursor is near the top of the window. | 1304 // Cursor is near the top of the window. |
1305 cursor_client.reset_calls_to_set_cursor(); | 1305 cursor_client.reset_calls_to_set_cursor(); |
1306 aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(80, 65)); | 1306 aura::Env::GetInstance()->SetLastMouseLocation(gfx::Point(80, 65)); |
1307 view_->UpdateCursorIfOverSelf(); | 1307 view_->UpdateCursorIfOverSelf(); |
1308 EXPECT_EQ(1, cursor_client.calls_to_set_cursor()); | 1308 EXPECT_EQ(1, cursor_client.calls_to_set_cursor()); |
1309 | 1309 |
1310 // Cursor is near the bottom of the window. | 1310 // Cursor is near the bottom of the window. |
1311 cursor_client.reset_calls_to_set_cursor(); | 1311 cursor_client.reset_calls_to_set_cursor(); |
1312 aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(159, 159)); | 1312 aura::Env::GetInstance()->SetLastMouseLocation(gfx::Point(159, 159)); |
1313 view_->UpdateCursorIfOverSelf(); | 1313 view_->UpdateCursorIfOverSelf(); |
1314 EXPECT_EQ(1, cursor_client.calls_to_set_cursor()); | 1314 EXPECT_EQ(1, cursor_client.calls_to_set_cursor()); |
1315 | 1315 |
1316 // Cursor is above the window. | 1316 // Cursor is above the window. |
1317 cursor_client.reset_calls_to_set_cursor(); | 1317 cursor_client.reset_calls_to_set_cursor(); |
1318 aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(67, 59)); | 1318 aura::Env::GetInstance()->SetLastMouseLocation(gfx::Point(67, 59)); |
1319 view_->UpdateCursorIfOverSelf(); | 1319 view_->UpdateCursorIfOverSelf(); |
1320 EXPECT_EQ(0, cursor_client.calls_to_set_cursor()); | 1320 EXPECT_EQ(0, cursor_client.calls_to_set_cursor()); |
1321 | 1321 |
1322 // Cursor is below the window. | 1322 // Cursor is below the window. |
1323 cursor_client.reset_calls_to_set_cursor(); | 1323 cursor_client.reset_calls_to_set_cursor(); |
1324 aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(161, 161)); | 1324 aura::Env::GetInstance()->SetLastMouseLocation(gfx::Point(161, 161)); |
1325 view_->UpdateCursorIfOverSelf(); | 1325 view_->UpdateCursorIfOverSelf(); |
1326 EXPECT_EQ(0, cursor_client.calls_to_set_cursor()); | 1326 EXPECT_EQ(0, cursor_client.calls_to_set_cursor()); |
1327 } | 1327 } |
1328 | 1328 |
1329 scoped_ptr<cc::CompositorFrame> MakeDelegatedFrame(float scale_factor, | 1329 scoped_ptr<cc::CompositorFrame> MakeDelegatedFrame(float scale_factor, |
1330 gfx::Size size, | 1330 gfx::Size size, |
1331 gfx::Rect damage) { | 1331 gfx::Rect damage) { |
1332 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); | 1332 scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); |
1333 frame->metadata.device_scale_factor = scale_factor; | 1333 frame->metadata.device_scale_factor = scale_factor; |
1334 frame->delegated_frame_data.reset(new cc::DelegatedFrameData); | 1334 frame->delegated_frame_data.reset(new cc::DelegatedFrameData); |
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3159 view_->OnScrollEvent(&scroll); | 3159 view_->OnScrollEvent(&scroll); |
3160 | 3160 |
3161 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); | 3161 input_event = GetInputEventFromMessage(*sink_->GetMessageAt(0)); |
3162 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); | 3162 wheel_event = static_cast<const WebMouseWheelEvent*>(input_event); |
3163 // Check if the canScroll set to true when ctrl-touchpad-scroll is generated | 3163 // Check if the canScroll set to true when ctrl-touchpad-scroll is generated |
3164 // from scroll event. | 3164 // from scroll event. |
3165 EXPECT_TRUE(wheel_event->canScroll); | 3165 EXPECT_TRUE(wheel_event->canScroll); |
3166 } | 3166 } |
3167 | 3167 |
3168 } // namespace content | 3168 } // namespace content |
OLD | NEW |