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/command_line.h" | |
5 #include "base/macros.h" | 6 #include "base/macros.h" |
6 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
7 #include "content/public/browser/web_contents_delegate.h" | 8 #include "content/public/browser/web_contents_delegate.h" |
8 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
9 #include "extensions/browser/guest_view/web_view/web_view_apitest.h" | 10 #include "extensions/browser/guest_view/web_view/web_view_apitest.h" |
10 #include "extensions/test/extension_test_message_listener.h" | 11 #include "extensions/test/extension_test_message_listener.h" |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 // This class intercepts media access request from the embedder. The request | 15 // This class intercepts media access request from the embedder. The request |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 74 |
74 // Runs media_access tests. | 75 // Runs media_access tests. |
75 void RunTest(const std::string& test_name) { | 76 void RunTest(const std::string& test_name) { |
76 ExtensionTestMessageListener test_run_listener("TEST_PASSED", false); | 77 ExtensionTestMessageListener test_run_listener("TEST_PASSED", false); |
77 test_run_listener.set_failure_message("TEST_FAILED"); | 78 test_run_listener.set_failure_message("TEST_FAILED"); |
78 EXPECT_TRUE(content::ExecuteScript( | 79 EXPECT_TRUE(content::ExecuteScript( |
79 embedder_web_contents_, | 80 embedder_web_contents_, |
80 base::StringPrintf("runTest('%s');", test_name.c_str()))); | 81 base::StringPrintf("runTest('%s');", test_name.c_str()))); |
81 ASSERT_TRUE(test_run_listener.WaitUntilSatisfied()); | 82 ASSERT_TRUE(test_run_listener.WaitUntilSatisfied()); |
82 } | 83 } |
84 | |
85 void SetUpCommandLine(base::CommandLine* command_line) override { | |
86 WebViewAPITest::SetUpCommandLine(command_line); | |
87 command_line->AppendSwitch("use-fake-device-for-media-stream"); | |
Devlin
2017/06/21 13:14:33
nit: maybe add a comment explaining why this is ne
Devlin
2017/06/21 13:14:33
Can we use the kUseFakeDeviceForMediaStream consta
Guido Urdaneta
2017/06/21 14:54:56
will do in the next patchset.
Guido Urdaneta
2017/06/21 14:54:56
No, due to layering rules.
Devlin
2017/06/21 19:21:26
Using the value of a constant doesn't make it less
Guido Urdaneta
2017/06/22 09:30:13
Done. I thought using the string directly was OK t
| |
88 } | |
83 }; | 89 }; |
84 | 90 |
85 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllow) { | 91 IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllow) { |
86 std::string app_location = "web_view/media_access/allow"; | 92 std::string app_location = "web_view/media_access/allow"; |
87 StartTestServer(app_location); | 93 StartTestServer(app_location); |
88 LaunchApp(app_location); | 94 LaunchApp(app_location); |
89 | 95 |
90 std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); | 96 std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate()); |
91 embedder_web_contents_->SetDelegate(mock.get()); | 97 embedder_web_contents_->SetDelegate(mock.get()); |
92 | 98 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 TestNoPreventDefaultImpliesDeny) { | 198 TestNoPreventDefaultImpliesDeny) { |
193 std::string app_location = "web_view/media_access/deny"; | 199 std::string app_location = "web_view/media_access/deny"; |
194 StartTestServer(app_location); | 200 StartTestServer(app_location); |
195 LaunchApp(app_location); | 201 LaunchApp(app_location); |
196 | 202 |
197 RunTest("testNoPreventDefaultImpliesDeny"); | 203 RunTest("testNoPreventDefaultImpliesDeny"); |
198 StopTestServer(); | 204 StopTestServer(); |
199 } | 205 } |
200 | 206 |
201 } // namespace extensions | 207 } // namespace extensions |
OLD | NEW |