summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media_uitest.cc
diff options
context:
space:
mode:
authornsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 15:51:21 +0000
committernsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 15:51:21 +0000
commit5a18973c436301794320afa7f4c56a7257a74c3d (patch)
tree440c39e178541d1e5746f610ab58c7179a4cd650 /chrome/browser/media_uitest.cc
parentcf068a59fffe58ea7ab978ea20132e7015b23fde (diff)
downloadchromium_src-5a18973c436301794320afa7f4c56a7257a74c3d.zip
chromium_src-5a18973c436301794320afa7f4c56a7257a74c3d.tar.gz
chromium_src-5a18973c436301794320afa7f4c56a7257a74c3d.tar.bz2
Revert 58910 - This broke the "Google Chrome" compile.
Original description: Added a media UI test case for fullscreen video implementation for Windows (which is not committed yet). However, it is currently disabled until the webkit patches are here. Also changed the other cases in media_uitest.cc to stop using Sleep() in test code. Instead, NotificationObserver and NotificationRegistrar are used. Thirdly, moved media_uitest.cc from ui_tests to interactive_ui_tests. TEST=ui_tests, interactive_ui_tests BUGS=54838 Review URL: http://codereview.chromium.org/3322009 TBR=imcheng@chromium.org Review URL: http://codereview.chromium.org/3318020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58944 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/media_uitest.cc')
-rw-r--r--chrome/browser/media_uitest.cc106
1 files changed, 106 insertions, 0 deletions
diff --git a/chrome/browser/media_uitest.cc b/chrome/browser/media_uitest.cc
new file mode 100644
index 0000000..f077b14
--- /dev/null
+++ b/chrome/browser/media_uitest.cc
@@ -0,0 +1,106 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/basictypes.h"
+#include "base/file_path.h"
+#include "base/platform_thread.h"
+#include "base/string_util.h"
+#include "chrome/test/ui/ui_layout_test.h"
+#include "chrome/test/ui/ui_test.h"
+#include "net/base/net_util.h"
+
+class MediaTest : public UITest {
+ protected:
+ void PlayMedia(const char* tag, const char* media_file) {
+ FilePath test_file(test_data_directory_);
+ test_file = test_file.AppendASCII("media/player.html");
+
+ GURL player_gurl = net::FilePathToFileURL(test_file);
+ std::string url = StringPrintf("%s?%s=%s",
+ player_gurl.spec().c_str(),
+ tag,
+ media_file);
+
+ NavigateToURL(GURL(url));
+
+ // Allow the media file to be loaded.
+ const std::wstring kPlaying = L"PLAYING";
+ const std::wstring kFailed = L"FAILED";
+ const std::wstring kError = L"ERROR";
+ for (int i = 0; i < 10; ++i) {
+ PlatformThread::Sleep(sleep_timeout_ms());
+ const std::wstring& title = GetActiveTabTitle();
+ if (title == kPlaying || title == kFailed ||
+ StartsWith(title, kError, true))
+ break;
+ }
+
+ EXPECT_EQ(kPlaying, GetActiveTabTitle());
+ }
+
+ void PlayAudio(const char* url) {
+ PlayMedia("audio", url);
+ }
+
+ void PlayVideo(const char* url) {
+ PlayMedia("video", url);
+ }
+};
+
+TEST_F(MediaTest, VideoBearTheora) {
+ PlayVideo("bear.ogv");
+}
+
+TEST_F(MediaTest, VideoBearSilentTheora) {
+ PlayVideo("bear_silent.ogv");
+}
+
+TEST_F(MediaTest, VideoBearWebm) {
+ PlayVideo("bear.webm");
+}
+
+TEST_F(MediaTest, VideoBearSilentWebm) {
+ PlayVideo("bear_silent.webm");
+}
+
+#if defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS)
+TEST_F(MediaTest, VideoBearMp4) {
+ PlayVideo("bear.mp4");
+}
+
+TEST_F(MediaTest, VideoBearSilentMp4) {
+ PlayVideo("bear_silent.mp4");
+}
+#endif
+
+TEST_F(UILayoutTest, MediaUILayoutTest) {
+ static const char* kResources[] = {
+ "content",
+ "media-file.js",
+ "media-fullscreen.js",
+ "video-paint-test.js",
+ "video-played.js",
+ "video-test.js",
+ };
+
+ static const char* kMediaTests[] = {
+ "video-autoplay.html",
+ // "video-loop.html", disabled due to 52887.
+ "video-no-autoplay.html",
+ // TODO(sergeyu): Add more tests here.
+ };
+
+ FilePath test_dir;
+ FilePath media_test_dir;
+ media_test_dir = media_test_dir.AppendASCII("media");
+ InitializeForLayoutTest(test_dir, media_test_dir, kNoHttpPort);
+
+ // Copy resources first.
+ for (size_t i = 0; i < arraysize(kResources); ++i)
+ AddResourceForLayoutTest(
+ test_dir, media_test_dir.AppendASCII(kResources[i]));
+
+ for (size_t i = 0; i < arraysize(kMediaTests); ++i)
+ RunLayoutTest(kMediaTests[i], kNoHttpPort);
+}