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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 scoped_ptr<cc::SingleReleaseCallback>()); | 1374 scoped_ptr<cc::SingleReleaseCallback>()); |
1374 | 1375 |
1375 // Because the copy request callback may be holding state within it, that | 1376 // Because the copy request callback may be holding state within it, that |
1376 // state must handle the RWHVA and ImageTransportFactory going away before the | 1377 // state must handle the RWHVA and ImageTransportFactory going away before the |
1377 // callback is called. This test passes if it does not crash as a result of | 1378 // callback is called. This test passes if it does not crash as a result of |
1378 // these things being destroyed. | 1379 // these things being destroyed. |
1379 EXPECT_EQ(2, callback_count_); | 1380 EXPECT_EQ(2, callback_count_); |
1380 EXPECT_FALSE(result_); | 1381 EXPECT_FALSE(result_); |
1381 } | 1382 } |
1382 | 1383 |
| 1384 TEST_F(RenderWidgetHostViewAuraTest, VisibleViewportTest) { |
| 1385 gfx::Rect view_rect(100, 100); |
| 1386 |
| 1387 view_->InitAsChild(NULL); |
| 1388 aura::client::ParentWindowWithContext( |
| 1389 view_->GetNativeView(), |
| 1390 parent_view_->GetNativeView()->GetRootWindow(), |
| 1391 gfx::Rect()); |
| 1392 view_->SetSize(view_rect.size()); |
| 1393 view_->WasShown(); |
| 1394 |
| 1395 // Defaults to full height of the view. |
| 1396 EXPECT_EQ(100, view_->GetVisibleViewportSize().height()); |
| 1397 |
| 1398 widget_host_->ResetSizeAndRepaintPendingFlags(); |
| 1399 sink_->ClearMessages(); |
| 1400 view_->SetInsets(gfx::Insets(0, 0, 40, 0)); |
| 1401 |
| 1402 EXPECT_EQ(60, view_->GetVisibleViewportSize().height()); |
| 1403 |
| 1404 const IPC::Message *message = sink_->GetFirstMessageMatching( |
| 1405 ViewMsg_Resize::ID); |
| 1406 ASSERT_TRUE(message != NULL); |
| 1407 |
| 1408 ViewMsg_Resize::Param params; |
| 1409 ViewMsg_Resize::Read(message, ¶ms); |
| 1410 EXPECT_EQ(60, params.a.visible_viewport_size.height()); |
| 1411 } |
| 1412 |
1383 } // namespace content | 1413 } // namespace content |
OLD | NEW |