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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 scoped_ptr<cc::SingleReleaseCallback>()); | 1338 scoped_ptr<cc::SingleReleaseCallback>()); |
1338 | 1339 |
1339 // Because the copy request callback may be holding state within it, that | 1340 // Because the copy request callback may be holding state within it, that |
1340 // state must handle the RWHVA and ImageTransportFactory going away before the | 1341 // 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 | 1342 // callback is called. This test passes if it does not crash as a result of |
1342 // these things being destroyed. | 1343 // these things being destroyed. |
1343 EXPECT_EQ(2, callback_count_); | 1344 EXPECT_EQ(2, callback_count_); |
1344 EXPECT_FALSE(result_); | 1345 EXPECT_FALSE(result_); |
1345 } | 1346 } |
1346 | 1347 |
| 1348 TEST_F(RenderWidgetHostViewAuraTest, VisibleViewportTest) { |
| 1349 gfx::Rect view_rect(100, 100); |
| 1350 |
| 1351 view_->InitAsChild(NULL); |
| 1352 aura::client::ParentWindowWithContext( |
| 1353 view_->GetNativeView(), |
| 1354 parent_view_->GetNativeView()->GetRootWindow(), |
| 1355 gfx::Rect()); |
| 1356 view_->SetSize(view_rect.size()); |
| 1357 view_->WasShown(); |
| 1358 |
| 1359 // Defaults to full height of the view. |
| 1360 EXPECT_EQ(100, view_->GetVisibleViewportHeight()); |
| 1361 |
| 1362 widget_host_->ResetSizeAndRepaintPendingFlags(); |
| 1363 sink_->ClearMessages(); |
| 1364 view_->SetKeyboardBounds(gfx::Rect(0, 60, 100, 100)); |
| 1365 |
| 1366 EXPECT_EQ(60, view_->GetVisibleViewportHeight()); |
| 1367 |
| 1368 const IPC::Message *message = sink_->GetFirstMessageMatching( |
| 1369 ViewMsg_Resize::ID); |
| 1370 ASSERT_TRUE(message != NULL); |
| 1371 |
| 1372 ViewMsg_Resize::Param params; |
| 1373 ViewMsg_Resize::Read(message, ¶ms); |
| 1374 EXPECT_EQ(60, params.a.visible_viewport_height); |
| 1375 } |
| 1376 |
1347 } // namespace content | 1377 } // namespace content |
OLD | NEW |