Chromium Code Reviews| 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/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "cc/output/compositor_frame.h" | 13 #include "cc/output/compositor_frame.h" |
| 13 #include "cc/output/compositor_frame_metadata.h" | 14 #include "cc/output/compositor_frame_metadata.h" |
| 14 #include "cc/output/copy_output_request.h" | 15 #include "cc/output/copy_output_request.h" |
| 15 #include "content/browser/browser_thread_impl.h" | 16 #include "content/browser/browser_thread_impl.h" |
| 16 #include "content/browser/compositor/resize_lock.h" | 17 #include "content/browser/compositor/resize_lock.h" |
| 17 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 18 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 38 #include "ui/aura/test/test_window_delegate.h" | 39 #include "ui/aura/test/test_window_delegate.h" |
| 39 #include "ui/aura/window.h" | 40 #include "ui/aura/window.h" |
| 40 #include "ui/aura/window_event_dispatcher.h" | 41 #include "ui/aura/window_event_dispatcher.h" |
| 41 #include "ui/aura/window_observer.h" | 42 #include "ui/aura/window_observer.h" |
| 42 #include "ui/base/ui_base_types.h" | 43 #include "ui/base/ui_base_types.h" |
| 43 #include "ui/compositor/compositor.h" | 44 #include "ui/compositor/compositor.h" |
| 44 #include "ui/compositor/test/draw_waiter_for_test.h" | 45 #include "ui/compositor/test/draw_waiter_for_test.h" |
| 45 #include "ui/compositor/test/in_process_context_factory.h" | 46 #include "ui/compositor/test/in_process_context_factory.h" |
| 46 #include "ui/events/event.h" | 47 #include "ui/events/event.h" |
| 47 #include "ui/events/event_utils.h" | 48 #include "ui/events/event_utils.h" |
| 49 #include "ui/keyboard/keyboard_switches.h" | |
| 50 #include "ui/keyboard/keyboard_util.h" | |
| 48 | 51 |
| 49 using testing::_; | 52 using testing::_; |
| 50 | 53 |
| 51 namespace content { | 54 namespace content { |
| 52 namespace { | 55 namespace { |
| 53 | 56 |
| 54 // Simple screen position client to test coordinate system conversion. | 57 // Simple screen position client to test coordinate system conversion. |
| 55 class TestScreenPositionClient | 58 class TestScreenPositionClient |
| 56 : public aura::client::ScreenPositionClient { | 59 : public aura::client::ScreenPositionClient { |
| 57 public: | 60 public: |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1337 scoped_ptr<cc::SingleReleaseCallback>()); | 1340 scoped_ptr<cc::SingleReleaseCallback>()); |
| 1338 | 1341 |
| 1339 // Because the copy request callback may be holding state within it, that | 1342 // Because the copy request callback may be holding state within it, that |
| 1340 // state must handle the RWHVA and ImageTransportFactory going away before the | 1343 // state must handle the RWHVA and ImageTransportFactory going away before the |
| 1341 // callback is called. This test passes if it does not crash as a result of | 1344 // callback is called. This test passes if it does not crash as a result of |
| 1342 // these things being destroyed. | 1345 // these things being destroyed. |
| 1343 EXPECT_EQ(2, callback_count_); | 1346 EXPECT_EQ(2, callback_count_); |
| 1344 EXPECT_FALSE(result_); | 1347 EXPECT_FALSE(result_); |
| 1345 } | 1348 } |
| 1346 | 1349 |
| 1350 #if defined(OS_CHROMEOS) | |
| 1351 | |
| 1352 class RenderWidgetHostViewAuraKeyboardTest | |
| 1353 : public RenderWidgetHostViewAuraTest { | |
| 1354 public: | |
| 1355 RenderWidgetHostViewAuraKeyboardTest() {} | |
| 1356 | |
| 1357 virtual void SetUp() { | |
|
sadrul
2014/04/15 16:26:43
OVERRIDE
kevers
2014/04/15 17:26:44
Done.
| |
| 1358 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 1359 command_line->AppendSwitch( | |
| 1360 keyboard::switches::kEnableVirtualKeyboard); | |
| 1361 command_line->AppendSwitch( | |
| 1362 keyboard::switches::kEnableVirtualKeyboardOverscroll); | |
| 1363 RenderWidgetHostViewAuraTest::SetUp(); | |
| 1364 } | |
| 1365 }; | |
| 1366 | |
| 1367 TEST_F(RenderWidgetHostViewAuraKeyboardTest, OverscrollTest) { | |
| 1368 gfx::Rect view_rect(100, 100); | |
| 1369 | |
| 1370 view_->InitAsChild(NULL); | |
| 1371 aura::client::ParentWindowWithContext( | |
| 1372 view_->GetNativeView(), | |
| 1373 parent_view_->GetNativeView()->GetRootWindow(), | |
| 1374 gfx::Rect()); | |
| 1375 view_->SetSize(view_rect.size()); | |
| 1376 view_->WasShown(); | |
| 1377 | |
| 1378 EXPECT_TRUE(keyboard::IsKeyboardOverscrollEnabled()); | |
| 1379 EXPECT_EQ("0,0 0x0", view_->virtual_keyboard_bounds_.ToString()); | |
| 1380 | |
| 1381 widget_host_->ResetSizeAndRepaintPendingFlags(); | |
| 1382 sink_->ClearMessages(); | |
| 1383 gfx::Rect keyboard_rect(0, 50, 100, 50); | |
| 1384 view_->OnKeyboardBoundsChanging(keyboard_rect); | |
| 1385 | |
| 1386 EXPECT_EQ("0,50 100x50", view_->virtual_keyboard_bounds_.ToString()); | |
| 1387 EXPECT_EQ(50, view_->GetOverdrawBottomHeight()); | |
| 1388 | |
| 1389 const IPC::Message *message = sink_->GetFirstMessageMatching( | |
| 1390 ViewMsg_Resize::ID); | |
| 1391 ASSERT_TRUE(message != NULL); | |
| 1392 | |
| 1393 ViewMsg_Resize::Param params; | |
| 1394 ViewMsg_Resize::Read(message, ¶ms); | |
| 1395 EXPECT_EQ(50, params.a.overdraw_bottom_height); | |
| 1396 } | |
| 1397 | |
| 1398 #endif // defined(OS_CHROMEOS) | |
| 1399 | |
| 1347 } // namespace content | 1400 } // namespace content |
| OLD | NEW |