OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/gl/gl_implementation.h" |
5 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
6 #include "base/file_path.h" | 7 #include "base/file_path.h" |
7 #include "base/platform_thread.h" | 8 #include "base/platform_thread.h" |
8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/test/test_launcher_utils.h" |
9 #include "chrome/test/ui/ui_layout_test.h" | 12 #include "chrome/test/ui/ui_layout_test.h" |
10 #include "chrome/test/ui/ui_test.h" | 13 #include "chrome/test/ui/ui_test.h" |
11 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
12 | 15 |
13 class MediaTest : public UITest { | 16 class MediaTest : public UITest { |
14 protected: | 17 protected: |
| 18 virtual void SetUp() { |
| 19 EXPECT_TRUE(test_launcher_utils::OverrideGLImplementation( |
| 20 &launch_arguments_, |
| 21 gfx::kGLImplementationOSMesaName)); |
| 22 |
| 23 #if defined(OS_MACOSX) |
| 24 // Accelerated compositing does not work with OSMesa. AcceleratedSurface |
| 25 // assumes GL contexts are native. |
| 26 launch_arguments_.AppendSwitch(switches::kDisableAcceleratedCompositing); |
| 27 #endif |
| 28 |
| 29 UITest::SetUp(); |
| 30 } |
| 31 |
15 void PlayMedia(const char* tag, const char* media_file) { | 32 void PlayMedia(const char* tag, const char* media_file) { |
16 FilePath test_file(test_data_directory_); | 33 FilePath test_file(test_data_directory_); |
17 test_file = test_file.AppendASCII("media/player.html"); | 34 test_file = test_file.AppendASCII("media/player.html"); |
18 | 35 |
19 GURL player_gurl = net::FilePathToFileURL(test_file); | 36 GURL player_gurl = net::FilePathToFileURL(test_file); |
20 std::string url = StringPrintf("%s?%s=%s", | 37 std::string url = StringPrintf("%s?%s=%s", |
21 player_gurl.spec().c_str(), | 38 player_gurl.spec().c_str(), |
22 tag, | 39 tag, |
23 media_file); | 40 media_file); |
24 | 41 |
(...skipping 16 matching lines...) Expand all Loading... |
41 | 58 |
42 void PlayAudio(const char* url) { | 59 void PlayAudio(const char* url) { |
43 PlayMedia("audio", url); | 60 PlayMedia("audio", url); |
44 } | 61 } |
45 | 62 |
46 void PlayVideo(const char* url) { | 63 void PlayVideo(const char* url) { |
47 PlayMedia("video", url); | 64 PlayMedia("video", url); |
48 } | 65 } |
49 }; | 66 }; |
50 | 67 |
51 #if defined(OS_WIN) | |
52 | |
53 // Tests always fail on windows: http://crbug.com/55477 | |
54 #define MAYBE_VideoBearTheora DISABLED_VideoBearTheora | |
55 #define MAYBE_VideoBearSilentTheora DISABLED_VideoBearSilentTheora | |
56 #define MAYBE_VideoBearWebm DISABLED_VideoBearWebm | |
57 #define MAYBE_VideoBearSilentWebm DISABLED_VideoBearSilentWebm | |
58 #define MAYBE_VideoBearMp4 DISABLED_VideoBearMp4 | |
59 #define MAYBE_VideoBearSilentMp4 DISABLED_VideoBearSilentMp4 | |
60 #define MAYBE_VideoBearWav DISABLED_VideoBearWav | |
61 #define MAYBE_MediaUILayoutTest DISABLED_MediaUILayoutTest | |
62 | |
63 #else | |
64 | |
65 #define MAYBE_VideoBearTheora VideoBearTheora | |
66 #define MAYBE_VideoBearSilentTheora VideoBearSilentTheora | |
67 #define MAYBE_VideoBearWebm VideoBearWebm | |
68 #define MAYBE_VideoBearSilentWebm VideoBearSilentWebm | |
69 #define MAYBE_VideoBearMp4 VideoBearMp4 | |
70 #define MAYBE_VideoBearSilentMp4 VideoBearSilentMp4 | |
71 #define MAYBE_VideoBearWav VideoBearWav | |
72 | |
73 #if defined(OS_LINUX) | 68 #if defined(OS_LINUX) |
74 // Test fails on linux: http://crbug.com/56364 | 69 // Test fails on linux: http://crbug.com/56364 |
75 #define MAYBE_MediaUILayoutTest DISABLED_MediaUILayoutTest | 70 #define MAYBE_MediaUILayoutTest DISABLED_MediaUILayoutTest |
76 #else | 71 #else |
77 #define MAYBE_MediaUILayoutTest MediaUILayoutTest | 72 #define MAYBE_MediaUILayoutTest MediaUILayoutTest |
78 #endif | 73 #endif |
79 | 74 |
80 #endif | 75 TEST_F(MediaTest, VideoBearTheora) { |
81 | |
82 TEST_F(MediaTest, MAYBE_VideoBearTheora) { | |
83 PlayVideo("bear.ogv"); | 76 PlayVideo("bear.ogv"); |
84 } | 77 } |
85 | 78 |
86 TEST_F(MediaTest, MAYBE_VideoBearSilentTheora) { | 79 TEST_F(MediaTest, VideoBearSilentTheora) { |
87 PlayVideo("bear_silent.ogv"); | 80 PlayVideo("bear_silent.ogv"); |
88 } | 81 } |
89 | 82 |
90 TEST_F(MediaTest, MAYBE_VideoBearWebm) { | 83 TEST_F(MediaTest, VideoBearWebm) { |
91 PlayVideo("bear.webm"); | 84 PlayVideo("bear.webm"); |
92 } | 85 } |
93 | 86 |
94 TEST_F(MediaTest, MAYBE_VideoBearSilentWebm) { | 87 TEST_F(MediaTest, VideoBearSilentWebm) { |
95 PlayVideo("bear_silent.webm"); | 88 PlayVideo("bear_silent.webm"); |
96 } | 89 } |
97 | 90 |
98 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) | 91 #if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
99 TEST_F(MediaTest, MAYBE_VideoBearMp4) { | 92 TEST_F(MediaTest, VideoBearMp4) { |
100 PlayVideo("bear.mp4"); | 93 PlayVideo("bear.mp4"); |
101 } | 94 } |
102 | 95 |
103 TEST_F(MediaTest, MAYBE_VideoBearSilentMp4) { | 96 TEST_F(MediaTest, VideoBearSilentMp4) { |
104 PlayVideo("bear_silent.mp4"); | 97 PlayVideo("bear_silent.mp4"); |
105 } | 98 } |
106 #endif | 99 #endif |
107 | 100 |
108 TEST_F(MediaTest, MAYBE_VideoBearWav) { | 101 TEST_F(MediaTest, VideoBearWav) { |
109 PlayVideo("bear.wav"); | 102 PlayVideo("bear.wav"); |
110 } | 103 } |
111 | 104 |
112 TEST_F(UILayoutTest, MAYBE_MediaUILayoutTest) { | 105 TEST_F(UILayoutTest, MAYBE_MediaUILayoutTest) { |
113 static const char* kResources[] = { | 106 static const char* kResources[] = { |
114 "content", | 107 "content", |
115 "media-file.js", | 108 "media-file.js", |
116 "media-fullscreen.js", | 109 "media-fullscreen.js", |
117 "video-paint-test.js", | 110 "video-paint-test.js", |
118 "video-played.js", | 111 "video-played.js", |
(...skipping 13 matching lines...) Expand all Loading... |
132 InitializeForLayoutTest(test_dir, media_test_dir, kNoHttpPort); | 125 InitializeForLayoutTest(test_dir, media_test_dir, kNoHttpPort); |
133 | 126 |
134 // Copy resources first. | 127 // Copy resources first. |
135 for (size_t i = 0; i < arraysize(kResources); ++i) | 128 for (size_t i = 0; i < arraysize(kResources); ++i) |
136 AddResourceForLayoutTest( | 129 AddResourceForLayoutTest( |
137 test_dir, media_test_dir.AppendASCII(kResources[i])); | 130 test_dir, media_test_dir.AppendASCII(kResources[i])); |
138 | 131 |
139 for (size_t i = 0; i < arraysize(kMediaTests); ++i) | 132 for (size_t i = 0; i < arraysize(kMediaTests); ++i) |
140 RunLayoutTest(kMediaTests[i], kNoHttpPort); | 133 RunLayoutTest(kMediaTests[i], kNoHttpPort); |
141 } | 134 } |
OLD | NEW |