| 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 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 TestBrowserContext browser_context; | 1263 TestBrowserContext browser_context; |
| 1264 MockRenderProcessHost* process_host = | 1264 MockRenderProcessHost* process_host = |
| 1265 new MockRenderProcessHost(&browser_context); | 1265 new MockRenderProcessHost(&browser_context); |
| 1266 process_host->Init(); | 1266 process_host->Init(); |
| 1267 MockRenderWidgetHostDelegate delegate; | 1267 MockRenderWidgetHostDelegate delegate; |
| 1268 int32_t routing_id = process_host->GetNextRoutingID(); | 1268 int32_t routing_id = process_host->GetNextRoutingID(); |
| 1269 MockRenderWidgetHostImpl* host = | 1269 MockRenderWidgetHostImpl* host = |
| 1270 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); | 1270 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); |
| 1271 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false); | 1271 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false); |
| 1272 | 1272 |
| 1273 EXPECT_TRUE(view->GetBackgroundOpaque()); | 1273 EXPECT_NE(static_cast<unsigned>(SK_ColorTRANSPARENT), |
| 1274 view->background_color()); |
| 1274 EXPECT_TRUE([view->cocoa_view() isOpaque]); | 1275 EXPECT_TRUE([view->cocoa_view() isOpaque]); |
| 1275 | 1276 |
| 1276 view->SetBackgroundColor(SK_ColorTRANSPARENT); | 1277 view->SetBackgroundColor(SK_ColorTRANSPARENT); |
| 1277 EXPECT_FALSE(view->GetBackgroundOpaque()); | 1278 EXPECT_EQ(static_cast<unsigned>(SK_ColorTRANSPARENT), |
| 1279 view->background_color()); |
| 1278 EXPECT_FALSE([view->cocoa_view() isOpaque]); | 1280 EXPECT_FALSE([view->cocoa_view() isOpaque]); |
| 1279 | 1281 |
| 1280 const IPC::Message* set_background; | 1282 const IPC::Message* set_background; |
| 1281 set_background = process_host->sink().GetUniqueMessageMatching( | 1283 set_background = process_host->sink().GetUniqueMessageMatching( |
| 1282 ViewMsg_SetBackgroundOpaque::ID); | 1284 ViewMsg_SetBackgroundOpaque::ID); |
| 1283 ASSERT_TRUE(set_background); | 1285 ASSERT_TRUE(set_background); |
| 1284 std::tuple<bool> sent_background; | 1286 std::tuple<bool> sent_background; |
| 1285 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); | 1287 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); |
| 1286 EXPECT_FALSE(std::get<0>(sent_background)); | 1288 EXPECT_FALSE(std::get<0>(sent_background)); |
| 1287 | 1289 |
| 1288 // Try setting it back. | 1290 // Try setting it back. |
| 1289 process_host->sink().ClearMessages(); | 1291 process_host->sink().ClearMessages(); |
| 1290 view->SetBackgroundColor(SK_ColorWHITE); | 1292 view->SetBackgroundColor(SK_ColorWHITE); |
| 1291 EXPECT_TRUE(view->GetBackgroundOpaque()); | 1293 EXPECT_EQ(static_cast<unsigned>(SK_ColorWHITE), view->background_color()); |
| 1292 EXPECT_TRUE([view->cocoa_view() isOpaque]); | 1294 EXPECT_TRUE([view->cocoa_view() isOpaque]); |
| 1293 set_background = process_host->sink().GetUniqueMessageMatching( | 1295 set_background = process_host->sink().GetUniqueMessageMatching( |
| 1294 ViewMsg_SetBackgroundOpaque::ID); | 1296 ViewMsg_SetBackgroundOpaque::ID); |
| 1295 ASSERT_TRUE(set_background); | 1297 ASSERT_TRUE(set_background); |
| 1296 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); | 1298 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); |
| 1297 EXPECT_TRUE(std::get<0>(sent_background)); | 1299 EXPECT_TRUE(std::get<0>(sent_background)); |
| 1298 | 1300 |
| 1299 host->ShutdownAndDestroyWidget(true); | 1301 host->ShutdownAndDestroyWidget(true); |
| 1300 } | 1302 } |
| 1301 | 1303 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 // Verify that this IPC is asking for no monitoring or immediate updates. | 1787 // Verify that this IPC is asking for no monitoring or immediate updates. |
| 1786 InputMsg_RequestCompositionUpdates::Read(composition_request_msg_for_child, | 1788 InputMsg_RequestCompositionUpdates::Read(composition_request_msg_for_child, |
| 1787 &child_msg_params); | 1789 &child_msg_params); |
| 1788 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); | 1790 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); |
| 1789 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); | 1791 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); |
| 1790 EXPECT_FALSE(is_child_msg_for_immediate_request); | 1792 EXPECT_FALSE(is_child_msg_for_immediate_request); |
| 1791 EXPECT_FALSE(is_child_msg_for_monitor_request); | 1793 EXPECT_FALSE(is_child_msg_for_monitor_request); |
| 1792 } | 1794 } |
| 1793 | 1795 |
| 1794 } // namespace content | 1796 } // namespace content |
| OLD | NEW |