| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 ++get_user_media_call_count_; | 70 ++get_user_media_call_count_; |
| 71 | 71 |
| 72 StartDetectingVideo(tab, "local-view"); | 72 StartDetectingVideo(tab, "local-view"); |
| 73 WaitForVideoToPlay(tab); | 73 WaitForVideoToPlay(tab); |
| 74 std::string actual_stream_size = GetStreamSize(tab, "local-view"); | 74 std::string actual_stream_size = GetStreamSize(tab, "local-view"); |
| 75 CloseLastLocalStream(tab); | 75 CloseLastLocalStream(tab); |
| 76 return actual_stream_size; | 76 return actual_stream_size; |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool IsOnQtKit() const { |
| 80 #if defined(OS_MACOSX) |
| 81 return GetParam() && std::string(GetParam()) == switches::kForceQTKit; |
| 82 #else |
| 83 return false; |
| 84 #endif |
| 85 } |
| 86 |
| 79 int get_user_media_call_count_; | 87 int get_user_media_call_count_; |
| 80 }; | 88 }; |
| 81 | 89 |
| 82 IN_PROC_BROWSER_TEST_P(WebRtcWebcamBrowserTest, | 90 IN_PROC_BROWSER_TEST_P(WebRtcWebcamBrowserTest, |
| 83 TestAcquiringAndReacquiringWebcam) { | 91 TestAcquiringAndReacquiringWebcam) { |
| 84 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 92 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 85 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 93 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 86 ui_test_utils::NavigateToURL(browser(), url); | 94 ui_test_utils::NavigateToURL(browser(), url); |
| 87 content::WebContents* tab = | 95 content::WebContents* tab = |
| 88 browser()->tab_strip_model()->GetActiveWebContents(); | 96 browser()->tab_strip_model()->GetActiveWebContents(); |
| 89 | 97 |
| 90 if (!HasWebcamAvailableOnSystem(tab)) { | 98 if (!HasWebcamAvailableOnSystem(tab)) { |
| 91 LOG(INFO) << "No webcam found on bot: skipping..."; | 99 LOG(INFO) << "No webcam found on bot: skipping..."; |
| 92 return; | 100 return; |
| 93 } | 101 } |
| 94 | 102 |
| 103 if (!IsOnQtKit()) { |
| 104 // Temporarily disabled on QtKit due to http://crbug.com/375185. |
| 105 EXPECT_EQ("320x240", |
| 106 GetUserMediaAndGetStreamSize(tab, |
| 107 kAudioVideoCallConstraintsQVGA)); |
| 108 } |
| 109 |
| 95 EXPECT_EQ("640x480", | 110 EXPECT_EQ("640x480", |
| 96 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraintsVGA)); | 111 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraintsVGA)); |
| 97 EXPECT_EQ("320x240", | |
| 98 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraintsQVGA)); | |
| 99 EXPECT_EQ("640x360", | 112 EXPECT_EQ("640x360", |
| 100 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraints360p)); | 113 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraints360p)); |
| 101 EXPECT_EQ("1280x720", | 114 EXPECT_EQ("1280x720", |
| 102 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraints720p)); | 115 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraints720p)); |
| 116 |
| 117 if (IsOnQtKit()) |
| 118 return; // QTKit only supports up to 720p. |
| 119 |
| 103 EXPECT_EQ("1920x1080", | 120 EXPECT_EQ("1920x1080", |
| 104 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraints1080p)); | 121 GetUserMediaAndGetStreamSize(tab, kAudioVideoCallConstraints1080p)); |
| 105 } | 122 } |
| 106 | 123 |
| 107 INSTANTIATE_TEST_CASE_P(WebRtcWebcamBrowserTests, | 124 INSTANTIATE_TEST_CASE_P(WebRtcWebcamBrowserTests, |
| 108 WebRtcWebcamBrowserTest, | 125 WebRtcWebcamBrowserTest, |
| 109 testing::ValuesIn(kTestConfigFlags)); | 126 testing::ValuesIn(kTestConfigFlags)); |
| OLD | NEW |