summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media_uitest.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-16 22:47:06 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-16 22:47:06 +0000
commit4b87e474248a7d635df9b48983c89f61f7f6d570 (patch)
tree081f3b749cd7d5cb6b9187eb3fe90380bc688134 /chrome/browser/media_uitest.cc
parentdbcda9bb32b1753395ebd40e0a3df9f47c0c8998 (diff)
downloadchromium_src-4b87e474248a7d635df9b48983c89f61f7f6d570.zip
chromium_src-4b87e474248a7d635df9b48983c89f61f7f6d570.tar.gz
chromium_src-4b87e474248a7d635df9b48983c89f61f7f6d570.tar.bz2
UI test for <video>
Simple ui test that goes through some test clips. TEST=MediaTest.* Review URL: http://codereview.chromium.org/125173 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18550 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/media_uitest.cc')
-rw-r--r--chrome/browser/media_uitest.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/chrome/browser/media_uitest.cc b/chrome/browser/media_uitest.cc
new file mode 100644
index 0000000..faa8d15
--- /dev/null
+++ b/chrome/browser/media_uitest.cc
@@ -0,0 +1,52 @@
+// 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_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, VideoBearH264) {
+ PlayVideo("bear.mp4");
+}