| 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 16 matching lines...) Expand all Loading... |
| 27 // Play specified audio over http:// or file:// depending on |http| setting. | 27 // Play specified audio over http:// or file:// depending on |http| setting. |
| 28 void PlayAudio(const char* media_file, bool http) { | 28 void PlayAudio(const char* media_file, bool http) { |
| 29 ASSERT_NO_FATAL_FAILURE(PlayMedia("audio", media_file, http)); | 29 ASSERT_NO_FATAL_FAILURE(PlayMedia("audio", media_file, http)); |
| 30 } | 30 } |
| 31 | 31 |
| 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: | |
| 38 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
| 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 | |
| 41 // muted. See http://crbug.com/120749 | |
| 42 command_line->AppendSwitch(switches::kDisableAudio); | |
| 43 } | |
| 44 | |
| 45 private: | 37 private: |
| 46 GURL GetTestURL(const char* tag, const char* media_file, bool http) { | 38 GURL GetTestURL(const char* tag, const char* media_file, bool http) { |
| 47 if (http) { | 39 if (http) { |
| 48 return test_server()->GetURL( | 40 return test_server()->GetURL( |
| 49 base::StringPrintf("files/media/player.html?%s=%s", tag, media_file)); | 41 base::StringPrintf("files/media/player.html?%s=%s", tag, media_file)); |
| 50 } | 42 } |
| 51 | 43 |
| 52 FilePath test_file_path = GetTestFilePath("media", "player.html"); | 44 FilePath test_file_path = GetTestFilePath("media", "player.html"); |
| 53 std::string query = base::StringPrintf("%s=%s", tag, media_file); | 45 std::string query = base::StringPrintf("%s=%s", tag, media_file); |
| 54 return GetFileUrlWithQuery(test_file_path, query); | 46 return GetFileUrlWithQuery(test_file_path, query); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 153 |
| 162 INSTANTIATE_TEST_CASE_P(File, MediaTest, ::testing::Values(false)); | 154 INSTANTIATE_TEST_CASE_P(File, MediaTest, ::testing::Values(false)); |
| 163 INSTANTIATE_TEST_CASE_P(Http, MediaTest, ::testing::Values(true)); | 155 INSTANTIATE_TEST_CASE_P(Http, MediaTest, ::testing::Values(true)); |
| 164 | 156 |
| 165 class MediaLayoutTest : public InProcessBrowserLayoutTest { | 157 class MediaLayoutTest : public InProcessBrowserLayoutTest { |
| 166 protected: | 158 protected: |
| 167 MediaLayoutTest() : InProcessBrowserLayoutTest( | 159 MediaLayoutTest() : InProcessBrowserLayoutTest( |
| 168 FilePath(), FilePath().AppendASCII("media")) { | 160 FilePath(), FilePath().AppendASCII("media")) { |
| 169 } | 161 } |
| 170 virtual ~MediaLayoutTest() {} | 162 virtual ~MediaLayoutTest() {} |
| 171 | |
| 172 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
| 173 InProcessBrowserLayoutTest::SetUpCommandLine(command_line); | |
| 174 // 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 | |
| 176 // muted. See http://crbug.com/120749 | |
| 177 command_line->AppendSwitch(switches::kDisableAudio); | |
| 178 } | |
| 179 }; | 163 }; |
| 180 | 164 |
| 181 // Each browser test can only correspond to a single layout test, otherwise the | 165 // 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 | 166 // 45 second timeout per test is not long enough for N tests on debug/asan/etc |
| 183 // builds. | 167 // builds. |
| 184 | 168 |
| 185 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoAutoplayTest) { | 169 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoAutoplayTest) { |
| 186 RunLayoutTest("video-autoplay.html"); | 170 RunLayoutTest("video-autoplay.html"); |
| 187 } | 171 } |
| 188 | 172 |
| 189 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoLoopTest) { | 173 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoLoopTest) { |
| 190 RunLayoutTest("video-loop.html"); | 174 RunLayoutTest("video-loop.html"); |
| 191 } | 175 } |
| 192 | 176 |
| 193 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoNoAutoplayTest) { | 177 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoNoAutoplayTest) { |
| 194 RunLayoutTest("video-no-autoplay.html"); | 178 RunLayoutTest("video-no-autoplay.html"); |
| 195 } | 179 } |
| 196 | 180 |
| 197 } // namespace content | 181 } // namespace content |
| OLD | NEW |