Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 // Play specified video over http:// or file:// depending on |http| setting. | 32 // Play specified video over http:// or file:// depending on |http| setting. |
| 33 void PlayVideo(const char* media_file, bool http) { | 33 void PlayVideo(const char* media_file, bool http) { |
| 34 ASSERT_NO_FATAL_FAILURE(PlayMedia("video", media_file, http)); | 34 ASSERT_NO_FATAL_FAILURE(PlayMedia("video", media_file, http)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 38 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 39 // TODO(dalecurtis): Not all Buildbots have viable audio devices, so disable | 39 // TODO(dalecurtis): Not all Buildbots have viable audio devices, so disable |
| 40 // audio to prevent tests from hanging; e.g., a device which is hardware | 40 // audio to prevent tests from hanging; e.g., a device which is hardware |
| 41 // muted. See http://crbug.com/120749 | 41 // muted. See http://crbug.com/120749 |
| 42 command_line->AppendSwitch(switches::kDisableAudio); | 42 command_line->AppendSwitch(switches::kDisableAudio); |
|
DaleCurtis
2012/11/06 21:54:51
I believe this can be removed now too since we hav
scherkus (not reviewing)
2012/11/06 21:57:04
Can you make that change in case it has unbeknowns
| |
| 43 } | 43 } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 GURL GetTestURL(const char* tag, const char* media_file, bool http) { | 46 GURL GetTestURL(const char* tag, const char* media_file, bool http) { |
| 47 if (http) { | 47 if (http) { |
| 48 return test_server()->GetURL( | 48 return test_server()->GetURL( |
| 49 base::StringPrintf("files/media/player.html?%s=%s", tag, media_file)); | 49 base::StringPrintf("files/media/player.html?%s=%s", tag, media_file)); |
| 50 } | 50 } |
| 51 | 51 |
| 52 FilePath test_file_path = GetTestFilePath("media", "player.html"); | 52 FilePath test_file_path = GetTestFilePath("media", "player.html"); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearFlac) { | 141 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearFlac) { |
| 142 PlayAudio("bear.flac", GetParam()); | 142 PlayAudio("bear.flac", GetParam()); |
| 143 } | 143 } |
| 144 #endif | 144 #endif |
| 145 #endif | 145 #endif |
| 146 | 146 |
| 147 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearWavPcm) { | 147 IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearWavPcm) { |
| 148 PlayAudio("bear_pcm.wav", GetParam()); | 148 PlayAudio("bear_pcm.wav", GetParam()); |
| 149 } | 149 } |
| 150 | 150 |
| 151 #if defined(OS_MACOSX) | |
| 152 // TODO(dalecurtis): Flaky on Mac 10.6. http://crbug.com/142896 | |
| 153 IN_PROC_BROWSER_TEST_P(MediaTest, FLAKY_VideoTulipWebm) { | |
| 154 PlayVideo("tulip2.webm", GetParam()); | |
| 155 } | |
| 156 #else | |
| 157 IN_PROC_BROWSER_TEST_P(MediaTest, VideoTulipWebm) { | 151 IN_PROC_BROWSER_TEST_P(MediaTest, VideoTulipWebm) { |
| 158 PlayVideo("tulip2.webm", GetParam()); | 152 PlayVideo("tulip2.webm", GetParam()); |
| 159 } | 153 } |
| 160 #endif | |
| 161 | 154 |
| 162 INSTANTIATE_TEST_CASE_P(File, MediaTest, ::testing::Values(false)); | 155 INSTANTIATE_TEST_CASE_P(File, MediaTest, ::testing::Values(false)); |
| 163 INSTANTIATE_TEST_CASE_P(Http, MediaTest, ::testing::Values(true)); | 156 INSTANTIATE_TEST_CASE_P(Http, MediaTest, ::testing::Values(true)); |
| 164 | 157 |
| 165 class MediaLayoutTest : public InProcessBrowserLayoutTest { | 158 class MediaLayoutTest : public InProcessBrowserLayoutTest { |
| 166 protected: | 159 protected: |
| 167 MediaLayoutTest() : InProcessBrowserLayoutTest( | 160 MediaLayoutTest() : InProcessBrowserLayoutTest( |
| 168 FilePath(), FilePath().AppendASCII("media")) { | 161 FilePath(), FilePath().AppendASCII("media")) { |
| 169 } | 162 } |
| 170 virtual ~MediaLayoutTest() {} | 163 virtual ~MediaLayoutTest() {} |
| 171 | 164 |
| 172 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 165 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 173 InProcessBrowserLayoutTest::SetUpCommandLine(command_line); | 166 InProcessBrowserLayoutTest::SetUpCommandLine(command_line); |
| 174 // TODO(dalecurtis): Not all Buildbots have viable audio devices, so disable | 167 // TODO(dalecurtis): Not all Buildbots have viable audio devices, so disable |
| 175 // audio to prevent tests from hanging; e.g., a device which is hardware | 168 // audio to prevent tests from hanging; e.g., a device which is hardware |
| 176 // muted. See http://crbug.com/120749 | 169 // muted. See http://crbug.com/120749 |
| 177 command_line->AppendSwitch(switches::kDisableAudio); | 170 command_line->AppendSwitch(switches::kDisableAudio); |
|
DaleCurtis
2012/11/06 21:54:51
Ditto.
| |
| 178 } | 171 } |
| 179 }; | 172 }; |
| 180 | 173 |
| 181 // Each browser test can only correspond to a single layout test, otherwise the | 174 // Each browser test can only correspond to a single layout test, otherwise the |
| 182 // 45 second timeout per test is not long enough for N tests on debug/asan/etc | 175 // 45 second timeout per test is not long enough for N tests on debug/asan/etc |
| 183 // builds. | 176 // builds. |
| 184 | 177 |
| 185 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoAutoplayTest) { | 178 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoAutoplayTest) { |
| 186 RunLayoutTest("video-autoplay.html"); | 179 RunLayoutTest("video-autoplay.html"); |
| 187 } | 180 } |
| 188 | 181 |
| 189 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoLoopTest) { | 182 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoLoopTest) { |
| 190 RunLayoutTest("video-loop.html"); | 183 RunLayoutTest("video-loop.html"); |
| 191 } | 184 } |
| 192 | 185 |
| 193 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoNoAutoplayTest) { | 186 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoNoAutoplayTest) { |
| 194 RunLayoutTest("video-no-autoplay.html"); | 187 RunLayoutTest("video-no-autoplay.html"); |
| 195 } | 188 } |
| 196 | 189 |
| 197 } // namespace content | 190 } // namespace content |
| OLD | NEW |