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/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 174 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
175 GLuint texture = gl_helper->ConsumeMailboxToTexture( | 175 GLuint texture = gl_helper->ConsumeMailboxToTexture( |
176 last_copy_request_->texture_mailbox().mailbox(), | 176 last_copy_request_->texture_mailbox().mailbox(), |
177 last_copy_request_->texture_mailbox().sync_point()); | 177 last_copy_request_->texture_mailbox().sync_point()); |
178 gl_helper->ResizeTexture(texture, window()->bounds().size()); | 178 gl_helper->ResizeTexture(texture, window()->bounds().size()); |
179 gl_helper->DeleteTexture(texture); | 179 gl_helper->DeleteTexture(texture); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 void RunOnCompositingDidCommit() { | 183 void RunOnCompositingDidCommit() { |
184 OnCompositingDidCommit(window()->GetDispatcher()->host()->compositor()); | 184 OnCompositingDidCommit(window()->GetHost()->compositor()); |
185 } | 185 } |
186 | 186 |
187 // A lock that doesn't actually do anything to the compositor, and does not | 187 // A lock that doesn't actually do anything to the compositor, and does not |
188 // time out. | 188 // time out. |
189 class FakeResizeLock : public ResizeLock { | 189 class FakeResizeLock : public ResizeLock { |
190 public: | 190 public: |
191 FakeResizeLock(const gfx::Size new_size, bool defer_compositor_lock) | 191 FakeResizeLock(const gfx::Size new_size, bool defer_compositor_lock) |
192 : ResizeLock(new_size, defer_compositor_lock) {} | 192 : ResizeLock(new_size, defer_compositor_lock) {} |
193 }; | 193 }; |
194 | 194 |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 gfx::Rect(params.a.screen_info.availableRect).ToString()); | 918 gfx::Rect(params.a.screen_info.availableRect).ToString()); |
919 EXPECT_EQ("800x600", params.a.new_size.ToString()); | 919 EXPECT_EQ("800x600", params.a.new_size.ToString()); |
920 // Resizes are blocked until we swapped a frame of the correct size, and | 920 // Resizes are blocked until we swapped a frame of the correct size, and |
921 // we've committed it. | 921 // we've committed it. |
922 view_->OnSwapCompositorFrame(0, | 922 view_->OnSwapCompositorFrame(0, |
923 MakeGLFrame(1.f, | 923 MakeGLFrame(1.f, |
924 params.a.new_size, | 924 params.a.new_size, |
925 gfx::Rect(params.a.new_size), | 925 gfx::Rect(params.a.new_size), |
926 owned_mailbox.get())); | 926 owned_mailbox.get())); |
927 ui::DrawWaiterForTest::WaitForCommit( | 927 ui::DrawWaiterForTest::WaitForCommit( |
928 root_window->GetDispatcher()->host()->compositor()); | 928 root_window->GetHost()->compositor()); |
929 } | 929 } |
930 | 930 |
931 widget_host_->ResetSizeAndRepaintPendingFlags(); | 931 widget_host_->ResetSizeAndRepaintPendingFlags(); |
932 sink_->ClearMessages(); | 932 sink_->ClearMessages(); |
933 | 933 |
934 // Make sure the corrent screen size is set along in the resize | 934 // Make sure the corrent screen size is set along in the resize |
935 // request when the screen size has changed. | 935 // request when the screen size has changed. |
936 aura_test_helper_->test_screen()->SetUIScale(0.5); | 936 aura_test_helper_->test_screen()->SetUIScale(0.5); |
937 EXPECT_EQ(1u, sink_->message_count()); | 937 EXPECT_EQ(1u, sink_->message_count()); |
938 { | 938 { |
939 const IPC::Message* msg = sink_->GetMessageAt(0); | 939 const IPC::Message* msg = sink_->GetMessageAt(0); |
940 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); | 940 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); |
941 ViewMsg_Resize::Param params; | 941 ViewMsg_Resize::Param params; |
942 ViewMsg_Resize::Read(msg, ¶ms); | 942 ViewMsg_Resize::Read(msg, ¶ms); |
943 EXPECT_EQ("0,0 1600x1200", | 943 EXPECT_EQ("0,0 1600x1200", |
944 gfx::Rect(params.a.screen_info.availableRect).ToString()); | 944 gfx::Rect(params.a.screen_info.availableRect).ToString()); |
945 EXPECT_EQ("1600x1200", params.a.new_size.ToString()); | 945 EXPECT_EQ("1600x1200", params.a.new_size.ToString()); |
946 view_->OnSwapCompositorFrame(0, | 946 view_->OnSwapCompositorFrame(0, |
947 MakeGLFrame(1.f, | 947 MakeGLFrame(1.f, |
948 params.a.new_size, | 948 params.a.new_size, |
949 gfx::Rect(params.a.new_size), | 949 gfx::Rect(params.a.new_size), |
950 owned_mailbox.get())); | 950 owned_mailbox.get())); |
951 ui::DrawWaiterForTest::WaitForCommit( | 951 ui::DrawWaiterForTest::WaitForCommit( |
952 root_window->GetDispatcher()->host()->compositor()); | 952 root_window->GetHost()->compositor()); |
953 } | 953 } |
954 } | 954 } |
955 | 955 |
956 // Swapping a frame should notify the window. | 956 // Swapping a frame should notify the window. |
957 TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { | 957 TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) { |
958 gfx::Size view_size(100, 100); | 958 gfx::Size view_size(100, 100); |
959 gfx::Rect view_rect(view_size); | 959 gfx::Rect view_rect(view_size); |
960 | 960 |
961 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); | 961 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); |
962 scoped_refptr<OwnedMailbox> owned_mailbox = new OwnedMailbox(gl_helper); | 962 scoped_refptr<OwnedMailbox> owned_mailbox = new OwnedMailbox(gl_helper); |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 | 1452 |
1453 // Because the copy request callback may be holding state within it, that | 1453 // Because the copy request callback may be holding state within it, that |
1454 // state must handle the RWHVA and ImageTransportFactory going away before the | 1454 // state must handle the RWHVA and ImageTransportFactory going away before the |
1455 // callback is called. This test passes if it does not crash as a result of | 1455 // callback is called. This test passes if it does not crash as a result of |
1456 // these things being destroyed. | 1456 // these things being destroyed. |
1457 EXPECT_EQ(2, callback_count_); | 1457 EXPECT_EQ(2, callback_count_); |
1458 EXPECT_FALSE(result_); | 1458 EXPECT_FALSE(result_); |
1459 } | 1459 } |
1460 | 1460 |
1461 } // namespace content | 1461 } // namespace content |
OLD | NEW |