Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code if governed by a BSD-style license that can be | 2 // Use of this source code if governed by a BSD-style license that can be |
| 3 // found in LICENSE file. | 3 // found in LICENSE file. |
| 4 | 4 |
| 5 #include "platform/scheduler/renderer/web_view_scheduler.h" | 5 #include "platform/scheduler/renderer/web_view_scheduler.h" |
| 6 #include "platform/testing/TestingPlatformSupport.h" | 6 #include "platform/testing/TestingPlatformSupport.h" |
| 7 #include "public/platform/WebRTCError.h" | 7 #include "public/platform/WebRTCError.h" |
| 8 #include "public/platform/WebRTCPeerConnectionHandler.h" | 8 #include "public/platform/WebRTCPeerConnectionHandler.h" |
| 9 #include "public/platform/WebRTCRtpReceiver.h" | 9 #include "public/platform/WebRTCRtpReceiver.h" |
| 10 #include "public/platform/WebRTCSessionDescription.h" | 10 #include "public/platform/WebRTCSessionDescription.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 } | 90 } |
| 91 WebRTCDTMFSenderHandler* CreateDTMFSender( | 91 WebRTCDTMFSenderHandler* CreateDTMFSender( |
| 92 const WebMediaStreamTrack&) override { | 92 const WebMediaStreamTrack&) override { |
| 93 return nullptr; | 93 return nullptr; |
| 94 } | 94 } |
| 95 void Stop() override {} | 95 void Stop() override {} |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 class TestingPlatformSupportWithWebRTC : public TestingPlatformSupport { | 98 class TestingPlatformSupportWithWebRTC : public TestingPlatformSupport { |
| 99 public: | 99 public: |
| 100 blink::WebRTCPeerConnectionHandler* CreateRTCPeerConnectionHandler( | 100 std::unique_ptr<blink::WebRTCPeerConnectionHandler> |
| 101 CreateRTCPeerConnectionHandler( | |
| 101 blink::WebRTCPeerConnectionHandlerClient*) override { | 102 blink::WebRTCPeerConnectionHandlerClient*) override { |
| 102 return new MockWebRTCPeerConnectionHandler(); | 103 return base::MakeUnique<MockWebRTCPeerConnectionHandler>(); |
|
haraken
2017/04/27 11:45:59
WTF::MakeUnique ?
altimin
2017/04/27 11:57:07
Done.
| |
| 103 } | 104 } |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 } // namespace | 107 } // namespace |
| 107 | 108 |
| 108 TEST_F(ActiveConnectionThrottlingTest, WebRTCStopsThrottling) { | 109 TEST_F(ActiveConnectionThrottlingTest, WebRTCStopsThrottling) { |
| 109 ScopedTestingPlatformSupport<TestingPlatformSupportWithWebRTC> platform; | 110 ScopedTestingPlatformSupport<TestingPlatformSupportWithWebRTC> platform; |
| 110 | 111 |
| 111 SimRequest main_resource("https://example.com/", "text/html"); | 112 SimRequest main_resource("https://example.com/", "text/html"); |
| 112 | 113 |
| 113 LoadURL("https://example.com/"); | 114 LoadURL("https://example.com/"); |
| 114 | 115 |
| 115 EXPECT_FALSE(WebView().Scheduler()->HasActiveConnectionForTest()); | 116 EXPECT_FALSE(WebView().Scheduler()->HasActiveConnectionForTest()); |
| 116 | 117 |
| 117 main_resource.Complete( | 118 main_resource.Complete( |
| 118 "(<script>" | 119 "(<script>" |
| 119 " var data_channel = new RTCPeerConnection();" | 120 " var data_channel = new RTCPeerConnection();" |
| 120 "</script>)"); | 121 "</script>)"); |
| 121 | 122 |
| 122 EXPECT_TRUE(WebView().Scheduler()->HasActiveConnectionForTest()); | 123 EXPECT_TRUE(WebView().Scheduler()->HasActiveConnectionForTest()); |
| 123 | 124 |
| 124 MainFrame().ExecuteScript(WebString("data_channel.close();")); | 125 MainFrame().ExecuteScript(WebString("data_channel.close();")); |
| 125 | 126 |
| 126 EXPECT_FALSE(WebView().Scheduler()->HasActiveConnectionForTest()); | 127 EXPECT_FALSE(WebView().Scheduler()->HasActiveConnectionForTest()); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |