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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/platform_thread.h" | 7 #include "base/platform_thread.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/test/ui/ui_layout_test.h" |
9 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
10 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
11 | 12 |
12 class MediaTest : public UITest { | 13 class MediaTest : public UITest { |
13 protected: | 14 protected: |
14 void PlayMedia(const char* tag, const char* media_file) { | 15 void PlayMedia(const char* tag, const char* media_file) { |
15 FilePath test_file(test_data_directory_); | 16 FilePath test_file(test_data_directory_); |
16 test_file = test_file.AppendASCII("media/player.html"); | 17 test_file = test_file.AppendASCII("media/player.html"); |
17 | 18 |
18 GURL player_gurl = net::FilePathToFileURL(test_file); | 19 GURL player_gurl = net::FilePathToFileURL(test_file); |
(...skipping 28 matching lines...) Expand all Loading... |
47 } | 48 } |
48 }; | 49 }; |
49 | 50 |
50 TEST_F(MediaTest, VideoBearTheora) { | 51 TEST_F(MediaTest, VideoBearTheora) { |
51 PlayVideo("bear.ogv"); | 52 PlayVideo("bear.ogv"); |
52 } | 53 } |
53 | 54 |
54 TEST_F(MediaTest, VideoBearSilentTheora) { | 55 TEST_F(MediaTest, VideoBearSilentTheora) { |
55 PlayVideo("bear_silent.ogv"); | 56 PlayVideo("bear_silent.ogv"); |
56 } | 57 } |
| 58 |
| 59 TEST_F(UILayoutTest, MediaUILayoutTest) { |
| 60 static const char* kResources[] = { |
| 61 "content", |
| 62 "media-file.js", |
| 63 "media-fullscreen.js", |
| 64 "video-paint-test.js", |
| 65 "video-played.js", |
| 66 "video-test.js", |
| 67 }; |
| 68 |
| 69 static const char* kMediaTests[] = { |
| 70 "video-autoplay.html", |
| 71 // "video-loop.html", disabled due to 52887. |
| 72 "video-no-autoplay.html", |
| 73 // TODO(sergeyu): Add more tests here. |
| 74 }; |
| 75 |
| 76 FilePath test_dir; |
| 77 FilePath media_test_dir; |
| 78 media_test_dir = media_test_dir.AppendASCII("media"); |
| 79 InitializeForLayoutTest(test_dir, media_test_dir, kNoHttpPort); |
| 80 |
| 81 // Copy resources first. |
| 82 for (size_t i = 0; i < arraysize(kResources); ++i) |
| 83 AddResourceForLayoutTest( |
| 84 test_dir, media_test_dir.AppendASCII(kResources[i])); |
| 85 |
| 86 for (size_t i = 0; i < arraysize(kMediaTests); ++i) |
| 87 RunLayoutTest(kMediaTests[i], kNoHttpPort); |
| 88 } |
OLD | NEW |