Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1127)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac_unittest.mm

Issue 2702153003: [content] Fix background color update handling in RWHVAura. (Closed)
Patch Set: add back static_casts since compile complains otherwise. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 TestBrowserContext browser_context; 1118 TestBrowserContext browser_context;
1119 MockRenderProcessHost* process_host = 1119 MockRenderProcessHost* process_host =
1120 new MockRenderProcessHost(&browser_context); 1120 new MockRenderProcessHost(&browser_context);
1121 process_host->Init(); 1121 process_host->Init();
1122 MockRenderWidgetHostDelegate delegate; 1122 MockRenderWidgetHostDelegate delegate;
1123 int32_t routing_id = process_host->GetNextRoutingID(); 1123 int32_t routing_id = process_host->GetNextRoutingID();
1124 MockRenderWidgetHostImpl* host = 1124 MockRenderWidgetHostImpl* host =
1125 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); 1125 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id);
1126 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false); 1126 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false);
1127 1127
1128 EXPECT_TRUE(view->GetBackgroundOpaque()); 1128 EXPECT_NE(static_cast<unsigned>(SK_ColorTRANSPARENT),
1129 view->background_color());
1129 EXPECT_TRUE([view->cocoa_view() isOpaque]); 1130 EXPECT_TRUE([view->cocoa_view() isOpaque]);
1130 1131
1131 view->SetBackgroundColor(SK_ColorTRANSPARENT); 1132 view->SetBackgroundColor(SK_ColorTRANSPARENT);
1132 EXPECT_FALSE(view->GetBackgroundOpaque()); 1133 EXPECT_EQ(static_cast<unsigned>(SK_ColorTRANSPARENT),
1134 view->background_color());
1133 EXPECT_FALSE([view->cocoa_view() isOpaque]); 1135 EXPECT_FALSE([view->cocoa_view() isOpaque]);
1134 1136
1135 const IPC::Message* set_background; 1137 const IPC::Message* set_background;
1136 set_background = process_host->sink().GetUniqueMessageMatching( 1138 set_background = process_host->sink().GetUniqueMessageMatching(
1137 ViewMsg_SetBackgroundOpaque::ID); 1139 ViewMsg_SetBackgroundOpaque::ID);
1138 ASSERT_TRUE(set_background); 1140 ASSERT_TRUE(set_background);
1139 std::tuple<bool> sent_background; 1141 std::tuple<bool> sent_background;
1140 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); 1142 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background);
1141 EXPECT_FALSE(std::get<0>(sent_background)); 1143 EXPECT_FALSE(std::get<0>(sent_background));
1142 1144
1143 // Try setting it back. 1145 // Try setting it back.
1144 process_host->sink().ClearMessages(); 1146 process_host->sink().ClearMessages();
1145 view->SetBackgroundColor(SK_ColorWHITE); 1147 view->SetBackgroundColor(SK_ColorWHITE);
1146 EXPECT_TRUE(view->GetBackgroundOpaque()); 1148 EXPECT_EQ(static_cast<unsigned>(SK_ColorWHITE), view->background_color());
1147 EXPECT_TRUE([view->cocoa_view() isOpaque]); 1149 EXPECT_TRUE([view->cocoa_view() isOpaque]);
1148 set_background = process_host->sink().GetUniqueMessageMatching( 1150 set_background = process_host->sink().GetUniqueMessageMatching(
1149 ViewMsg_SetBackgroundOpaque::ID); 1151 ViewMsg_SetBackgroundOpaque::ID);
1150 ASSERT_TRUE(set_background); 1152 ASSERT_TRUE(set_background);
1151 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); 1153 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background);
1152 EXPECT_TRUE(std::get<0>(sent_background)); 1154 EXPECT_TRUE(std::get<0>(sent_background));
1153 1155
1154 host->ShutdownAndDestroyWidget(true); 1156 host->ShutdownAndDestroyWidget(true);
1155 } 1157 }
1156 1158
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 // Verify that this IPC is asking for no monitoring or immediate updates. 1642 // Verify that this IPC is asking for no monitoring or immediate updates.
1641 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child, 1643 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child,
1642 &child_msg_params); 1644 &child_msg_params);
1643 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); 1645 is_child_msg_for_immediate_request = std::get<0>(child_msg_params);
1644 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); 1646 is_child_msg_for_monitor_request = std::get<1>(child_msg_params);
1645 EXPECT_FALSE(is_child_msg_for_immediate_request); 1647 EXPECT_FALSE(is_child_msg_for_immediate_request);
1646 EXPECT_FALSE(is_child_msg_for_monitor_request); 1648 EXPECT_FALSE(is_child_msg_for_monitor_request);
1647 } 1649 }
1648 1650
1649 } // namespace content 1651 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698