| 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/command_line.h" |
| 6 #include "chrome/browser/media/webrtc_browsertest_base.h" | 6 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 7 #include "chrome/browser/media/webrtc_browsertest_common.h" | 7 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_tabstrip.h" | 9 #include "chrome/browser/ui/browser_tabstrip.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 NULL | 32 NULL |
| 33 #endif | 33 #endif |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 // These tests runs on real webcams and ensure WebRTC can acquire webcams | 36 // These tests runs on real webcams and ensure WebRTC can acquire webcams |
| 37 // correctly. They will do nothing if there are no webcams on the system. | 37 // correctly. They will do nothing if there are no webcams on the system. |
| 38 // The webcam on the system must support up to 1080p, or the test will fail. | 38 // The webcam on the system must support up to 1080p, or the test will fail. |
| 39 class WebRtcWebcamBrowserTest : public WebRtcTestBase, | 39 class WebRtcWebcamBrowserTest : public WebRtcTestBase, |
| 40 public testing::WithParamInterface<const char*> { | 40 public testing::WithParamInterface<const char*> { |
| 41 public: | 41 public: |
| 42 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 42 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 43 EXPECT_FALSE(command_line->HasSwitch( | 43 EXPECT_FALSE(command_line->HasSwitch( |
| 44 switches::kUseFakeDeviceForMediaStream)); | 44 switches::kUseFakeDeviceForMediaStream)); |
| 45 EXPECT_FALSE(command_line->HasSwitch( | 45 EXPECT_FALSE(command_line->HasSwitch( |
| 46 switches::kUseFakeUIForMediaStream)); | 46 switches::kUseFakeUIForMediaStream)); |
| 47 if (GetParam()) | 47 if (GetParam()) |
| 48 command_line->AppendSwitch(GetParam()); | 48 command_line->AppendSwitch(GetParam()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 52 virtual void SetUpInProcessBrowserTestFixture() override { |
| 53 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 53 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
| 54 } | 54 } |
| 55 | 55 |
| 56 std::string GetUserMediaAndGetStreamSize(content::WebContents* tab, | 56 std::string GetUserMediaAndGetStreamSize(content::WebContents* tab, |
| 57 const std::string& constraints) { | 57 const std::string& constraints) { |
| 58 GetUserMediaWithSpecificConstraintsAndAccept(tab, constraints); | 58 GetUserMediaWithSpecificConstraintsAndAccept(tab, constraints); |
| 59 | 59 |
| 60 StartDetectingVideo(tab, "local-view"); | 60 StartDetectingVideo(tab, "local-view"); |
| 61 WaitForVideoToPlay(tab); | 61 WaitForVideoToPlay(tab); |
| 62 std::string actual_stream_size = GetStreamSize(tab, "local-view"); | 62 std::string actual_stream_size = GetStreamSize(tab, "local-view"); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 if (IsOnQtKit()) | 103 if (IsOnQtKit()) |
| 104 return; // QTKit only supports up to 720p. | 104 return; // QTKit only supports up to 720p. |
| 105 | 105 |
| 106 EXPECT_EQ("1920x1080", | 106 EXPECT_EQ("1920x1080", |
| 107 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraints1080p)); | 107 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraints1080p)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 INSTANTIATE_TEST_CASE_P(WebRtcWebcamBrowserTests, | 110 INSTANTIATE_TEST_CASE_P(WebRtcWebcamBrowserTests, |
| 111 WebRtcWebcamBrowserTest, | 111 WebRtcWebcamBrowserTest, |
| 112 testing::ValuesIn(kTestConfigFlags)); | 112 testing::ValuesIn(kTestConfigFlags)); |
| OLD | NEW |