Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: content/browser/webrtc/webrtc_video_capture_browsertest.cc

Issue 2910843002: [Cleanup] Move all browsertests to use ScopedFeatureList to modify features
Patch Set: comments addressed and updated Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/command_line.h"
6 #include "base/test/scoped_feature_list.h"
6 #include "build/build_config.h" 7 #include "build/build_config.h"
7 #include "content/browser/webrtc/webrtc_webcam_browsertest.h" 8 #include "content/browser/webrtc/webrtc_webcam_browsertest.h"
8 #include "content/public/browser/browser_child_process_host.h" 9 #include "content/public/browser/browser_child_process_host.h"
9 #include "content/public/common/child_process_host.h" 10 #include "content/public/common/child_process_host.h"
10 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
11 #include "content/public/common/service_manager_connection.h" 12 #include "content/public/common/service_manager_connection.h"
12 #include "content/public/test/browser_test_utils.h" 13 #include "content/public/test/browser_test_utils.h"
13 #include "content/public/test/content_browser_test_utils.h" 14 #include "content/public/test/content_browser_test_utils.h"
14 #include "content/shell/browser/shell.h" 15 #include "content/shell/browser/shell.h"
15 #include "media/base/media_switches.h" 16 #include "media/base/media_switches.h"
(...skipping 25 matching lines...) Expand all
41 "verifyHasReceivedTrackEndedEvent()"; 42 "verifyHasReceivedTrackEndedEvent()";
42 43
43 } // anonymous namespace 44 } // anonymous namespace
44 45
45 // Integration test that exercises video capture functionality from the 46 // Integration test that exercises video capture functionality from the
46 // JavaScript level. 47 // JavaScript level.
47 class WebRtcVideoCaptureBrowserTest : public ContentBrowserTest { 48 class WebRtcVideoCaptureBrowserTest : public ContentBrowserTest {
48 protected: 49 protected:
49 void SetUpCommandLine(base::CommandLine* command_line) override { 50 void SetUpCommandLine(base::CommandLine* command_line) override {
50 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); 51 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
51 command_line->AppendSwitchASCII(switches::kEnableFeatures,
52 video_capture::kMojoVideoCapture.name);
53 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); 52 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
54 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 53 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
55 switches::kEnableBlinkFeatures, "GetUserMedia"); 54 switches::kEnableBlinkFeatures, "GetUserMedia");
56 } 55 }
57 56
58 void SetUp() override { 57 void SetUp() override {
59 ASSERT_TRUE(embedded_test_server()->InitializeAndListen()); 58 ASSERT_TRUE(embedded_test_server()->InitializeAndListen());
59 scoped_feature_list_.InitAndEnableFeature(video_capture::kMojoVideoCapture);
60 EnablePixelOutput(); 60 EnablePixelOutput();
61 ContentBrowserTest::SetUp(); 61 ContentBrowserTest::SetUp();
62 } 62 }
63
64 private:
65 base::test::ScopedFeatureList scoped_feature_list_;
63 }; 66 };
64 67
65 IN_PROC_BROWSER_TEST_F(WebRtcVideoCaptureBrowserTest, 68 IN_PROC_BROWSER_TEST_F(WebRtcVideoCaptureBrowserTest,
66 MAYBE_RecoverFromCrashInVideoCaptureProcess) { 69 MAYBE_RecoverFromCrashInVideoCaptureProcess) {
67 embedded_test_server()->StartAcceptingConnections(); 70 embedded_test_server()->StartAcceptingConnections();
68 GURL url(embedded_test_server()->GetURL(kVideoCaptureHtmlFile)); 71 GURL url(embedded_test_server()->GetURL(kVideoCaptureHtmlFile));
69 NavigateToURL(shell(), url); 72 NavigateToURL(shell(), url);
70 73
71 std::string result; 74 std::string result;
72 // Start video capture and wait until it started rendering 75 // Start video capture and wait until it started rendering
(...skipping 17 matching lines...) Expand all
90 shell(), kVerifyHasReceivedTrackEndedEvent, &result)); 93 shell(), kVerifyHasReceivedTrackEndedEvent, &result));
91 ASSERT_EQ("OK", result); 94 ASSERT_EQ("OK", result);
92 95
93 // Start capturing again and expect it to work. 96 // Start capturing again and expect it to work.
94 ASSERT_TRUE(ExecuteScriptAndExtractString( 97 ASSERT_TRUE(ExecuteScriptAndExtractString(
95 shell(), kStartVideoCaptureAndVerifySize, &result)); 98 shell(), kStartVideoCaptureAndVerifySize, &result));
96 ASSERT_EQ("OK", result); 99 ASSERT_EQ("OK", result);
97 } 100 }
98 101
99 } // namespace content 102 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698