| 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/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "content/public/browser/web_contents_delegate.h" | 7 #include "content/public/browser/web_contents_delegate.h" |
| 8 #include "content/public/test/browser_test_utils.h" | 8 #include "content/public/test/browser_test_utils.h" |
| 9 #include "extensions/browser/guest_view/web_view/web_view_apitest.h" | 9 #include "extensions/browser/guest_view/web_view/web_view_apitest.h" |
| 10 #include "extensions/test/extension_test_message_listener.h" | 10 #include "extensions/test/extension_test_message_listener.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 void TearDownOnMainThread() override { | 90 void TearDownOnMainThread() override { |
| 91 WebViewAPITest::TearDownOnMainThread(); | 91 WebViewAPITest::TearDownOnMainThread(); |
| 92 StopTestServer(); | 92 StopTestServer(); |
| 93 } | 93 } |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllow) { | 96 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllow) { |
| 97 LaunchApp("web_view/media_access/allow"); | 97 LaunchApp("web_view/media_access/allow"); |
| 98 scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); | 98 std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); |
| 99 embedder_web_contents_->SetDelegate(mock.get()); | 99 embedder_web_contents_->SetDelegate(mock.get()); |
| 100 | 100 |
| 101 RunTest("testAllow"); | 101 RunTest("testAllow"); |
| 102 | 102 |
| 103 mock->WaitForRequestMediaPermission(); | 103 mock->WaitForRequestMediaPermission(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowAndThenDeny) { | 106 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowAndThenDeny) { |
| 107 LaunchApp("web_view/media_access/allow"); | 107 LaunchApp("web_view/media_access/allow"); |
| 108 scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); | 108 std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); |
| 109 embedder_web_contents_->SetDelegate(mock.get()); | 109 embedder_web_contents_->SetDelegate(mock.get()); |
| 110 | 110 |
| 111 RunTest("testAllowAndThenDeny"); | 111 RunTest("testAllowAndThenDeny"); |
| 112 | 112 |
| 113 mock->WaitForRequestMediaPermission(); | 113 mock->WaitForRequestMediaPermission(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowAsync) { | 116 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowAsync) { |
| 117 LaunchApp("web_view/media_access/allow"); | 117 LaunchApp("web_view/media_access/allow"); |
| 118 scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); | 118 std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); |
| 119 embedder_web_contents_->SetDelegate(mock.get()); | 119 embedder_web_contents_->SetDelegate(mock.get()); |
| 120 | 120 |
| 121 RunTest("testAllowAsync"); | 121 RunTest("testAllowAsync"); |
| 122 | 122 |
| 123 mock->WaitForRequestMediaPermission(); | 123 mock->WaitForRequestMediaPermission(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowTwice) { | 126 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowTwice) { |
| 127 LaunchApp("web_view/media_access/allow"); | 127 LaunchApp("web_view/media_access/allow"); |
| 128 scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); | 128 std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); |
| 129 embedder_web_contents_->SetDelegate(mock.get()); | 129 embedder_web_contents_->SetDelegate(mock.get()); |
| 130 | 130 |
| 131 RunTest("testAllowTwice"); | 131 RunTest("testAllowTwice"); |
| 132 | 132 |
| 133 mock->WaitForRequestMediaPermission(); | 133 mock->WaitForRequestMediaPermission(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestCheck) { | 136 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestCheck) { |
| 137 LaunchApp("web_view/media_access/check"); | 137 LaunchApp("web_view/media_access/check"); |
| 138 scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); | 138 std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); |
| 139 embedder_web_contents_->SetDelegate(mock.get()); | 139 embedder_web_contents_->SetDelegate(mock.get()); |
| 140 | 140 |
| 141 RunTest("testCheck"); | 141 RunTest("testCheck"); |
| 142 | 142 |
| 143 mock->WaitForCheckMediaPermission(); | 143 mock->WaitForCheckMediaPermission(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestDeny) { | 146 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestDeny) { |
| 147 LaunchApp("web_view/media_access/deny"); | 147 LaunchApp("web_view/media_access/deny"); |
| 148 RunTest("testDeny"); | 148 RunTest("testDeny"); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 163 RunTest("testNoListenersImplyDeny"); | 163 RunTest("testNoListenersImplyDeny"); |
| 164 } | 164 } |
| 165 | 165 |
| 166 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, | 166 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, |
| 167 TestNoPreventDefaultImpliesDeny) { | 167 TestNoPreventDefaultImpliesDeny) { |
| 168 LaunchApp("web_view/media_access/deny"); | 168 LaunchApp("web_view/media_access/deny"); |
| 169 RunTest("testNoPreventDefaultImpliesDeny"); | 169 RunTest("testNoPreventDefaultImpliesDeny"); |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace extensions | 172 } // namespace extensions |
| OLD | NEW |