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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 view_->SetSize(view_size); | 942 view_->SetSize(view_size); |
943 view_->WasShown(); | 943 view_->WasShown(); |
944 | 944 |
945 MockWindowObserver observer; | 945 MockWindowObserver observer; |
946 view_->window_->AddObserver(&observer); | 946 view_->window_->AddObserver(&observer); |
947 | 947 |
948 // Swap a frame through the GPU path. | 948 // Swap a frame through the GPU path. |
949 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 949 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
950 params.surface_id = widget_host_->surface_id(); | 950 params.surface_id = widget_host_->surface_id(); |
951 params.route_id = widget_host_->GetRoutingID(); | 951 params.route_id = widget_host_->GetRoutingID(); |
952 params.mailbox_name = std::string(64, '1'); | 952 memset(params.mailbox.name, '1', sizeof(params.mailbox.name)); |
953 params.size = view_size; | 953 params.size = view_size; |
954 params.scale_factor = 1.f; | 954 params.scale_factor = 1.f; |
955 | 955 |
956 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); | 956 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); |
957 view_->AcceleratedSurfaceBuffersSwapped(params, 0); | 957 view_->AcceleratedSurfaceBuffersSwapped(params, 0); |
958 testing::Mock::VerifyAndClearExpectations(&observer); | 958 testing::Mock::VerifyAndClearExpectations(&observer); |
959 | 959 |
960 // DSF = 2 | 960 // DSF = 2 |
961 params.size = gfx::Size(200, 200); | 961 params.size = gfx::Size(200, 200); |
962 params.scale_factor = 2.f; | 962 params.scale_factor = 2.f; |
963 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); | 963 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, view_rect)); |
964 view_->AcceleratedSurfaceBuffersSwapped(params, 0); | 964 view_->AcceleratedSurfaceBuffersSwapped(params, 0); |
965 testing::Mock::VerifyAndClearExpectations(&observer); | 965 testing::Mock::VerifyAndClearExpectations(&observer); |
966 | 966 |
967 // Partial frames though GPU path | 967 // Partial frames though GPU path |
968 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params post_params; | 968 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params post_params; |
969 post_params.surface_id = widget_host_->surface_id(); | 969 post_params.surface_id = widget_host_->surface_id(); |
970 post_params.route_id = widget_host_->GetRoutingID(); | 970 post_params.route_id = widget_host_->GetRoutingID(); |
971 post_params.mailbox_name = std::string(64, '1'); | 971 memset(post_params.mailbox.name, '1', sizeof(post_params.mailbox.name)); |
972 post_params.surface_size = gfx::Size(200, 200); | 972 post_params.surface_size = gfx::Size(200, 200); |
973 post_params.surface_scale_factor = 2.f; | 973 post_params.surface_scale_factor = 2.f; |
974 post_params.x = 40; | 974 post_params.x = 40; |
975 post_params.y = 40; | 975 post_params.y = 40; |
976 post_params.width = 80; | 976 post_params.width = 80; |
977 post_params.height = 80; | 977 post_params.height = 80; |
978 // rect from params is upside down, and is inflated in RWHVA, just because. | 978 // rect from params is upside down, and is inflated in RWHVA, just because. |
979 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, | 979 EXPECT_CALL(observer, OnWindowPaintScheduled(view_->window_, |
980 gfx::Rect(19, 39, 42, 42))); | 980 gfx::Rect(19, 39, 42, 42))); |
981 view_->AcceleratedSurfacePostSubBuffer(post_params, 0); | 981 view_->AcceleratedSurfacePostSubBuffer(post_params, 0); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 | 1413 |
1414 // Because the copy request callback may be holding state within it, that | 1414 // Because the copy request callback may be holding state within it, that |
1415 // state must handle the RWHVA and ImageTransportFactory going away before the | 1415 // state must handle the RWHVA and ImageTransportFactory going away before the |
1416 // callback is called. This test passes if it does not crash as a result of | 1416 // callback is called. This test passes if it does not crash as a result of |
1417 // these things being destroyed. | 1417 // these things being destroyed. |
1418 EXPECT_EQ(2, callback_count_); | 1418 EXPECT_EQ(2, callback_count_); |
1419 EXPECT_FALSE(result_); | 1419 EXPECT_FALSE(result_); |
1420 } | 1420 } |
1421 | 1421 |
1422 } // namespace content | 1422 } // namespace content |
OLD | NEW |