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

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: Remove GetBackgroundOpaque and base impls of accessors. 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_EQ(static_cast<unsigned>(SK_AlphaOPAQUE),
1129 SkColorGetA(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_AlphaTRANSPARENT),
danakj 2017/02/28 17:52:31 can EXPECT_EQ(TRANSPARENT, background_color()) her
Eric Seckler 2017/03/01 10:22:09 Done.
1134 SkColorGetA(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_AlphaOPAQUE),
danakj 2017/02/28 17:52:31 and EXPECT_EQ(WHITE, background_color()) if u like
Eric Seckler 2017/03/01 10:22:09 Done.
1149 SkColorGetA(view->background_color()));
1147 EXPECT_TRUE([view->cocoa_view() isOpaque]); 1150 EXPECT_TRUE([view->cocoa_view() isOpaque]);
1148 set_background = process_host->sink().GetUniqueMessageMatching( 1151 set_background = process_host->sink().GetUniqueMessageMatching(
1149 ViewMsg_SetBackgroundOpaque::ID); 1152 ViewMsg_SetBackgroundOpaque::ID);
1150 ASSERT_TRUE(set_background); 1153 ASSERT_TRUE(set_background);
1151 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background); 1154 ViewMsg_SetBackgroundOpaque::Read(set_background, &sent_background);
1152 EXPECT_TRUE(std::get<0>(sent_background)); 1155 EXPECT_TRUE(std::get<0>(sent_background));
1153 1156
1154 host->ShutdownAndDestroyWidget(true); 1157 host->ShutdownAndDestroyWidget(true);
1155 } 1158 }
1156 1159
(...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. 1643 // Verify that this IPC is asking for no monitoring or immediate updates.
1641 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child, 1644 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child,
1642 &child_msg_params); 1645 &child_msg_params);
1643 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); 1646 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); 1647 is_child_msg_for_monitor_request = std::get<1>(child_msg_params);
1645 EXPECT_FALSE(is_child_msg_for_immediate_request); 1648 EXPECT_FALSE(is_child_msg_for_immediate_request);
1646 EXPECT_FALSE(is_child_msg_for_monitor_request); 1649 EXPECT_FALSE(is_child_msg_for_monitor_request);
1647 } 1650 }
1648 1651
1649 } // namespace content 1652 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698