| 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/file_path.h" | 5 #include "content/test/layout_browsertest.h" |
| 6 #include "chrome/test/ui/ui_layout_test.h" | |
| 7 | 6 |
| 8 namespace { | 7 class AudioLayoutTest : public InProcessBrowserLayoutTest { |
| 9 const char* kResources[] = { | 8 protected: |
| 10 "content", | 9 AudioLayoutTest() : InProcessBrowserLayoutTest( |
| 11 "media-file.js", | 10 FilePath(), FilePath().AppendASCII("media")) { |
| 12 "video-test.js", | 11 } |
| 13 }; | 12 virtual ~AudioLayoutTest() {} |
| 14 } // anonymous namespace | |
| 15 | 13 |
| 16 class AudioUILayoutTest : public UILayoutTest { | 14 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 17 protected: | 15 InProcessBrowserLayoutTest::SetUpInProcessBrowserTestFixture(); |
| 18 virtual ~AudioUILayoutTest() { } | 16 AddResourceForLayoutTest(FilePath().AppendASCII("media"), |
| 19 | 17 FilePath().AppendASCII("content")); |
| 20 void RunMediaLayoutTest(const std::string& test_case_file_name) { | 18 AddResourceForLayoutTest(FilePath().AppendASCII("media"), |
| 21 FilePath test_dir; | 19 FilePath().AppendASCII("media-file.js")); |
| 22 FilePath media_test_dir; | 20 AddResourceForLayoutTest(FilePath().AppendASCII("media"), |
| 23 media_test_dir = media_test_dir.AppendASCII("media"); | 21 FilePath().AppendASCII("video-test.js")); |
| 24 InitializeForLayoutTest(test_dir, media_test_dir, kNoHttpPort); | 22 } |
| 25 | |
| 26 // Copy resources first. | |
| 27 for (size_t i = 0; i < arraysize(kResources); ++i) { | |
| 28 AddResourceForLayoutTest( | |
| 29 test_dir, media_test_dir.AppendASCII(kResources[i])); | |
| 30 } | |
| 31 | |
| 32 printf("Test: %s\n", test_case_file_name.c_str()); | |
| 33 RunLayoutTest(test_case_file_name, kNoHttpPort); | |
| 34 } | |
| 35 }; | 23 }; |
| 36 | 24 |
| 37 | 25 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, AudioConstructorPreload) { |
| 38 TEST_F(AudioUILayoutTest, AudioConstructorPreload) { | 26 RunLayoutTest("audio-constructor-preload.html"); |
| 39 RunMediaLayoutTest("audio-constructor-preload.html"); | |
| 40 } | 27 } |
| 41 | 28 |
| 42 TEST_F(AudioUILayoutTest, AudioConstructor) { | 29 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, AudioConstructor) { |
| 43 RunMediaLayoutTest("audio-constructor.html"); | 30 RunLayoutTest("audio-constructor.html"); |
| 44 } | 31 } |
| 45 | 32 |
| 46 TEST_F(AudioUILayoutTest, AudioConstructorSrc) { | 33 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, AudioConstructorSrc) { |
| 47 RunMediaLayoutTest("audio-constructor-src.html"); | 34 RunLayoutTest("audio-constructor-src.html"); |
| 48 } | 35 } |
| 49 | 36 |
| 50 TEST_F(AudioUILayoutTest, AudioDataUrl) { | 37 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, AudioDataUrl) { |
| 51 RunMediaLayoutTest("audio-data-url.html"); | 38 RunLayoutTest("audio-data-url.html"); |
| 52 } | 39 } |
| 53 | 40 |
| 54 // The test fails since there is no real audio device on the build bots to get | 41 // The test fails since there is no real audio device on the build bots to get |
| 55 // the ended event fired. Should pass once we run it on bots with audio devices. | 42 // the ended event fired. Should pass once we run it on bots with audio devices. |
| 56 TEST_F(AudioUILayoutTest, DISABLED_AudioGarbageCollect) { | 43 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, DISABLED_AudioGarbageCollect) { |
| 57 RunMediaLayoutTest("audio-garbage-collect.html"); | 44 RunLayoutTest("audio-garbage-collect.html"); |
| 58 } | 45 } |
| 59 | 46 |
| 60 TEST_F(AudioUILayoutTest, AudioNoInstalledEngines) { | 47 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, AudioNoInstalledEngines) { |
| 61 RunMediaLayoutTest("audio-no-installed-engines.html"); | 48 RunLayoutTest("audio-no-installed-engines.html"); |
| 62 } | 49 } |
| 63 | 50 |
| 64 #if defined(OS_CHROMEOS) && defined(USE_AURA) | 51 #if defined(OS_CHROMEOS) && defined(USE_AURA) |
| 65 // http://crbug.com/115530 | 52 // http://crbug.com/115530 |
| 66 #define MAYBE_AudioOnlyVideoIntrinsicSize DISABLED_AudioOnlyVideoIntrinsicSize | 53 #define MAYBE_AudioOnlyVideoIntrinsicSize DISABLED_AudioOnlyVideoIntrinsicSize |
| 67 #else | 54 #else |
| 68 #define MAYBE_AudioOnlyVideoIntrinsicSize AudioOnlyVideoIntrinsicSize | 55 #define MAYBE_AudioOnlyVideoIntrinsicSize AudioOnlyVideoIntrinsicSize |
| 69 #endif | 56 #endif |
| 70 | 57 |
| 71 TEST_F(AudioUILayoutTest, MAYBE_AudioOnlyVideoIntrinsicSize) { | 58 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, MAYBE_AudioOnlyVideoIntrinsicSize) { |
| 72 RunMediaLayoutTest("audio-only-video-intrinsic-size.html"); | 59 RunLayoutTest("audio-only-video-intrinsic-size.html"); |
| 73 } | 60 } |
| 74 | 61 |
| 75 TEST_F(AudioUILayoutTest, AudioPlayEvent) { | 62 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, AudioPlayEvent) { |
| 76 RunMediaLayoutTest("audio-play-event.html"); | 63 RunLayoutTest("audio-play-event.html"); |
| 77 } | 64 } |
| 78 | 65 |
| 79 TEST_F(AudioUILayoutTest, MediaCanPlayWavAudio) { | 66 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, MediaCanPlayWavAudio) { |
| 80 RunMediaLayoutTest("media-can-play-wav-audio.html"); | 67 RunLayoutTest("media-can-play-wav-audio.html"); |
| 81 } | 68 } |
| 82 | 69 |
| 83 TEST_F(AudioUILayoutTest, MediaDocumentAudioSize) { | 70 IN_PROC_BROWSER_TEST_F(AudioLayoutTest, MediaDocumentAudioSize) { |
| 84 RunMediaLayoutTest("media-document-audio-size.html"); | 71 RunLayoutTest("media-document-audio-size.html"); |
| 85 } | 72 } |
| 86 | |
| OLD | NEW |