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_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #include <Cocoa/Cocoa.h> | 7 #include <Cocoa/Cocoa.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 TestBrowserContext browser_context; | 1264 TestBrowserContext browser_context; |
1265 MockRenderProcessHost* process_host = | 1265 MockRenderProcessHost* process_host = |
1266 new MockRenderProcessHost(&browser_context); | 1266 new MockRenderProcessHost(&browser_context); |
1267 process_host->Init(); | 1267 process_host->Init(); |
1268 MockRenderWidgetHostDelegate delegate; | 1268 MockRenderWidgetHostDelegate delegate; |
1269 int32_t routing_id = process_host->GetNextRoutingID(); | 1269 int32_t routing_id = process_host->GetNextRoutingID(); |
1270 MockRenderWidgetHostImpl* host = | 1270 MockRenderWidgetHostImpl* host = |
1271 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); | 1271 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); |
1272 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false); | 1272 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false); |
1273 | 1273 |
| 1274 EXPECT_EQ(static_cast<unsigned>(SK_ColorTRANSPARENT), |
| 1275 view->background_color()); |
| 1276 EXPECT_FALSE([view->cocoa_view() isOpaque]); |
| 1277 |
| 1278 view->SetBackgroundColor(SK_ColorWHITE); |
1274 EXPECT_NE(static_cast<unsigned>(SK_ColorTRANSPARENT), | 1279 EXPECT_NE(static_cast<unsigned>(SK_ColorTRANSPARENT), |
1275 view->background_color()); | 1280 view->background_color()); |
1276 EXPECT_TRUE([view->cocoa_view() isOpaque]); | 1281 EXPECT_TRUE([view->cocoa_view() isOpaque]); |
1277 | 1282 |
1278 view->SetBackgroundColor(SK_ColorTRANSPARENT); | |
1279 EXPECT_EQ(static_cast<unsigned>(SK_ColorTRANSPARENT), | |
1280 view->background_color()); | |
1281 EXPECT_FALSE([view->cocoa_view() isOpaque]); | |
1282 | |
1283 const IPC::Message* set_background; | 1283 const IPC::Message* set_background; |
1284 set_background = process_host->sink().GetUniqueMessageMatching( | 1284 set_background = process_host->sink().GetUniqueMessageMatching( |
1285 ViewMsg_SetBackgroundOpaque::ID); | 1285 ViewMsg_SetBackgroundOpaque::ID); |
1286 ASSERT_TRUE(set_background); | 1286 ASSERT_TRUE(set_background); |
1287 std::tuple<bool> sent_background; | 1287 std::tuple<bool> sent_background; |
1288 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); | 1288 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); |
1289 EXPECT_FALSE(std::get<0>(sent_background)); | 1289 EXPECT_TRUE(std::get<0>(sent_background)); |
1290 | 1290 |
1291 // Try setting it back. | 1291 // Try setting it back. |
1292 process_host->sink().ClearMessages(); | 1292 process_host->sink().ClearMessages(); |
1293 view->SetBackgroundColor(SK_ColorWHITE); | 1293 view->SetBackgroundColor(SK_ColorTRANSPARENT); |
1294 EXPECT_EQ(static_cast<unsigned>(SK_ColorWHITE), view->background_color()); | 1294 EXPECT_EQ(static_cast<unsigned>(SK_ColorTRANSPARENT), |
1295 EXPECT_TRUE([view->cocoa_view() isOpaque]); | 1295 view->background_color()); |
| 1296 EXPECT_FALSE([view->cocoa_view() isOpaque]); |
1296 set_background = process_host->sink().GetUniqueMessageMatching( | 1297 set_background = process_host->sink().GetUniqueMessageMatching( |
1297 ViewMsg_SetBackgroundOpaque::ID); | 1298 ViewMsg_SetBackgroundOpaque::ID); |
1298 ASSERT_TRUE(set_background); | 1299 ASSERT_TRUE(set_background); |
1299 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); | 1300 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); |
1300 EXPECT_TRUE(std::get<0>(sent_background)); | 1301 EXPECT_FALSE(std::get<0>(sent_background)); |
1301 | 1302 |
1302 host->ShutdownAndDestroyWidget(true); | 1303 host->ShutdownAndDestroyWidget(true); |
1303 } | 1304 } |
1304 | 1305 |
1305 class RenderWidgetHostViewMacPinchTest : public RenderWidgetHostViewMacTest { | 1306 class RenderWidgetHostViewMacPinchTest : public RenderWidgetHostViewMacTest { |
1306 public: | 1307 public: |
1307 RenderWidgetHostViewMacPinchTest() : process_host_(nullptr) {} | 1308 RenderWidgetHostViewMacPinchTest() : process_host_(nullptr) {} |
1308 | 1309 |
1309 bool ZoomDisabledForPinchUpdateMessage() { | 1310 bool ZoomDisabledForPinchUpdateMessage() { |
1310 const IPC::Message* message = nullptr; | 1311 const IPC::Message* message = nullptr; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 // Verify that this IPC is asking for no monitoring or immediate updates. | 1789 // Verify that this IPC is asking for no monitoring or immediate updates. |
1789 InputMsg_RequestCompositionUpdates::Read(composition_request_msg_for_child, | 1790 InputMsg_RequestCompositionUpdates::Read(composition_request_msg_for_child, |
1790 &child_msg_params); | 1791 &child_msg_params); |
1791 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); | 1792 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); |
1792 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); | 1793 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); |
1793 EXPECT_FALSE(is_child_msg_for_immediate_request); | 1794 EXPECT_FALSE(is_child_msg_for_immediate_request); |
1794 EXPECT_FALSE(is_child_msg_for_monitor_request); | 1795 EXPECT_FALSE(is_child_msg_for_monitor_request); |
1795 } | 1796 } |
1796 | 1797 |
1797 } // namespace content | 1798 } // namespace content |
OLD | NEW |