OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
6 #include "content/common/frame_messages.h" | 6 #include "content/common/frame_messages.h" |
7 #include "content/common/view_message_enums.h" | 7 #include "content/common/view_message_enums.h" |
8 #include "content/public/test/render_view_test.h" | 8 #include "content/public/test/render_view_test.h" |
9 #include "content/renderer/pepper/plugin_power_saver_helper.h" | 9 #include "content/renderer/pepper/plugin_power_saver_helper.h" |
10 #include "content/renderer/render_frame_impl.h" | 10 #include "content/renderer/render_frame_impl.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 MakeParams("http://b.com/foo.swf", std::string(), "100", "100"), GURL(), | 158 MakeParams("http://b.com/foo.swf", std::string(), "100", "100"), GURL(), |
159 nullptr, &cross_origin_main_content)); | 159 nullptr, &cross_origin_main_content)); |
160 EXPECT_FALSE(cross_origin_main_content); | 160 EXPECT_FALSE(cross_origin_main_content); |
161 | 161 |
162 // Test that we've sent an IPC to the browser. | 162 // Test that we've sent an IPC to the browser. |
163 ASSERT_EQ(1u, sink_->message_count()); | 163 ASSERT_EQ(1u, sink_->message_count()); |
164 const IPC::Message* msg = sink_->GetMessageAt(0); | 164 const IPC::Message* msg = sink_->GetMessageAt(0); |
165 EXPECT_EQ(FrameHostMsg_PluginContentOriginAllowed::ID, msg->type()); | 165 EXPECT_EQ(FrameHostMsg_PluginContentOriginAllowed::ID, msg->type()); |
166 FrameHostMsg_PluginContentOriginAllowed::Param params; | 166 FrameHostMsg_PluginContentOriginAllowed::Param params; |
167 FrameHostMsg_PluginContentOriginAllowed::Read(msg, ¶ms); | 167 FrameHostMsg_PluginContentOriginAllowed::Read(msg, ¶ms); |
168 EXPECT_EQ(GURL("http://b.com"), params.a); | 168 EXPECT_EQ(GURL("http://b.com"), get<0>(params)); |
169 } | 169 } |
170 | 170 |
171 TEST_F(PluginPowerSaverHelperTest, UnthrottleOnExPostFactoWhitelist) { | 171 TEST_F(PluginPowerSaverHelperTest, UnthrottleOnExPostFactoWhitelist) { |
172 base::RunLoop loop; | 172 base::RunLoop loop; |
173 frame()->RegisterPeripheralPlugin(GURL("http://other.com"), | 173 frame()->RegisterPeripheralPlugin(GURL("http://other.com"), |
174 loop.QuitClosure()); | 174 loop.QuitClosure()); |
175 | 175 |
176 std::set<GURL> origin_whitelist; | 176 std::set<GURL> origin_whitelist; |
177 origin_whitelist.insert(GURL("http://other.com")); | 177 origin_whitelist.insert(GURL("http://other.com")); |
178 frame()->OnMessageReceived(FrameMsg_UpdatePluginContentOriginWhitelist( | 178 frame()->OnMessageReceived(FrameMsg_UpdatePluginContentOriginWhitelist( |
(...skipping 11 matching lines...) Expand all Loading... |
190 nullptr, nullptr)); | 190 nullptr, nullptr)); |
191 | 191 |
192 LoadHTML("<html></html>"); | 192 LoadHTML("<html></html>"); |
193 | 193 |
194 EXPECT_TRUE(frame()->ShouldThrottleContent( | 194 EXPECT_TRUE(frame()->ShouldThrottleContent( |
195 MakeParams("http://b.com/foo.swf", std::string(), "100", "100"), GURL(), | 195 MakeParams("http://b.com/foo.swf", std::string(), "100", "100"), GURL(), |
196 nullptr, nullptr)); | 196 nullptr, nullptr)); |
197 } | 197 } |
198 | 198 |
199 } // namespace content | 199 } // namespace content |
OLD | NEW |