| 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 <tuple> |
| 6 |
| 5 #include "base/macros.h" | 7 #include "base/macros.h" |
| 6 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 7 #include "content/common/frame_messages.h" | 9 #include "content/common/frame_messages.h" |
| 8 #include "content/common/view_message_enums.h" | 10 #include "content/common/view_message_enums.h" |
| 9 #include "content/public/common/content_constants.h" | 11 #include "content/public/common/content_constants.h" |
| 10 #include "content/public/test/frame_load_waiter.h" | 12 #include "content/public/test/frame_load_waiter.h" |
| 11 #include "content/public/test/render_view_test.h" | 13 #include "content/public/test/render_view_test.h" |
| 12 #include "content/renderer/pepper/plugin_power_saver_helper.h" | 14 #include "content/renderer/pepper/plugin_power_saver_helper.h" |
| 13 #include "content/renderer/render_frame_impl.h" | 15 #include "content/renderer/render_frame_impl.h" |
| 14 #include "content/renderer/render_view_impl.h" | 16 #include "content/renderer/render_view_impl.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 url::Origin(GURL("http://same.com")), | 59 url::Origin(GURL("http://same.com")), |
| 58 url::Origin(GURL("http://other.com")), gfx::Size(100, 100))); | 60 url::Origin(GURL("http://other.com")), gfx::Size(100, 100))); |
| 59 | 61 |
| 60 // Test that we've sent an IPC to the browser. | 62 // Test that we've sent an IPC to the browser. |
| 61 ASSERT_EQ(1u, sink_->message_count()); | 63 ASSERT_EQ(1u, sink_->message_count()); |
| 62 const IPC::Message* msg = sink_->GetMessageAt(0); | 64 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 63 EXPECT_EQ(FrameHostMsg_PluginContentOriginAllowed::ID, msg->type()); | 65 EXPECT_EQ(FrameHostMsg_PluginContentOriginAllowed::ID, msg->type()); |
| 64 FrameHostMsg_PluginContentOriginAllowed::Param params; | 66 FrameHostMsg_PluginContentOriginAllowed::Param params; |
| 65 FrameHostMsg_PluginContentOriginAllowed::Read(msg, ¶ms); | 67 FrameHostMsg_PluginContentOriginAllowed::Read(msg, ¶ms); |
| 66 EXPECT_TRUE(url::Origin(GURL("http://other.com")) | 68 EXPECT_TRUE(url::Origin(GURL("http://other.com")) |
| 67 .IsSameOriginWith(base::get<0>(params))); | 69 .IsSameOriginWith(std::get<0>(params))); |
| 68 } | 70 } |
| 69 | 71 |
| 70 TEST_F(PluginPowerSaverHelperTest, UnthrottleOnExPostFactoWhitelist) { | 72 TEST_F(PluginPowerSaverHelperTest, UnthrottleOnExPostFactoWhitelist) { |
| 71 base::RunLoop loop; | 73 base::RunLoop loop; |
| 72 frame()->RegisterPeripheralPlugin(url::Origin(GURL("http://other.com")), | 74 frame()->RegisterPeripheralPlugin(url::Origin(GURL("http://other.com")), |
| 73 loop.QuitClosure()); | 75 loop.QuitClosure()); |
| 74 | 76 |
| 75 std::set<url::Origin> origin_whitelist; | 77 std::set<url::Origin> origin_whitelist; |
| 76 origin_whitelist.insert(url::Origin(GURL("http://other.com"))); | 78 origin_whitelist.insert(url::Origin(GURL("http://other.com"))); |
| 77 frame()->OnMessageReceived(FrameMsg_UpdatePluginContentOriginWhitelist( | 79 frame()->OnMessageReceived(FrameMsg_UpdatePluginContentOriginWhitelist( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 | 93 |
| 92 LoadHTML("<html></html>"); | 94 LoadHTML("<html></html>"); |
| 93 | 95 |
| 94 EXPECT_EQ(RenderFrame::CONTENT_STATUS_PERIPHERAL, | 96 EXPECT_EQ(RenderFrame::CONTENT_STATUS_PERIPHERAL, |
| 95 frame()->GetPeripheralContentStatus( | 97 frame()->GetPeripheralContentStatus( |
| 96 url::Origin(GURL("http://same.com")), | 98 url::Origin(GURL("http://same.com")), |
| 97 url::Origin(GURL("http://other.com")), gfx::Size(100, 100))); | 99 url::Origin(GURL("http://other.com")), gfx::Size(100, 100))); |
| 98 } | 100 } |
| 99 | 101 |
| 100 } // namespace content | 102 } // namespace content |
| OLD | NEW |