| 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/string16.h" | 6 #include "base/string16.h" |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_tabstrip.h" | 11 #include "chrome/browser/ui/browser_tabstrip.h" |
| 12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
| 13 #include "content/public/test/browser_test_utils.h" |
| 13 #include "content/test/layout_browsertest.h" | 14 #include "content/test/layout_browsertest.h" |
| 14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 15 | 16 |
| 16 class MediaTest : public InProcessBrowserTest { | 17 class MediaTest : public InProcessBrowserTest { |
| 17 protected: | 18 protected: |
| 18 GURL GetTestURL(const char* tag, const char* media_file) { | 19 GURL GetTestURL(const char* tag, const char* media_file) { |
| 19 FilePath test_file_path = ui_test_utils::GetTestFilePath( | 20 FilePath test_file_path = ui_test_utils::GetTestFilePath( |
| 20 FilePath(FILE_PATH_LITERAL("media")), | 21 FilePath(FILE_PATH_LITERAL("media")), |
| 21 FilePath(FILE_PATH_LITERAL("player.html"))); | 22 FilePath(FILE_PATH_LITERAL("player.html"))); |
| 22 std::string query = base::StringPrintf("%s=%s", tag, media_file); | 23 std::string query = base::StringPrintf("%s=%s", tag, media_file); |
| 23 return ui_test_utils::GetFileUrlWithQuery(test_file_path, query); | 24 return ui_test_utils::GetFileUrlWithQuery(test_file_path, query); |
| 24 } | 25 } |
| 25 | 26 |
| 26 void PlayMedia(const char* tag, const char* media_file) { | 27 void PlayMedia(const char* tag, const char* media_file) { |
| 27 GURL player_gurl = GetTestURL(tag, media_file); | 28 GURL player_gurl = GetTestURL(tag, media_file); |
| 28 | 29 |
| 29 // Allow the media file to be loaded. | 30 // Allow the media file to be loaded. |
| 30 const string16 kPlaying = ASCIIToUTF16("PLAYING"); | 31 const string16 kPlaying = ASCIIToUTF16("PLAYING"); |
| 31 const string16 kFailed = ASCIIToUTF16("FAILED"); | 32 const string16 kFailed = ASCIIToUTF16("FAILED"); |
| 32 const string16 kError = ASCIIToUTF16("ERROR"); | 33 const string16 kError = ASCIIToUTF16("ERROR"); |
| 33 ui_test_utils::TitleWatcher title_watcher( | 34 content::TitleWatcher title_watcher( |
| 34 chrome::GetActiveWebContents(browser()), kPlaying); | 35 chrome::GetActiveWebContents(browser()), kPlaying); |
| 35 title_watcher.AlsoWaitForTitle(kFailed); | 36 title_watcher.AlsoWaitForTitle(kFailed); |
| 36 title_watcher.AlsoWaitForTitle(kError); | 37 title_watcher.AlsoWaitForTitle(kError); |
| 37 | 38 |
| 38 ui_test_utils::NavigateToURL(browser(), player_gurl); | 39 ui_test_utils::NavigateToURL(browser(), player_gurl); |
| 39 | 40 |
| 40 string16 final_title = title_watcher.WaitAndGetTitle(); | 41 string16 final_title = title_watcher.WaitAndGetTitle(); |
| 41 EXPECT_EQ(kPlaying, final_title); | 42 EXPECT_EQ(kPlaying, final_title); |
| 42 } | 43 } |
| 43 | 44 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 150 } |
| 150 | 151 |
| 151 // TODO(dalecurtis): Disabled because loop is flaky. http://crbug.com/134021 | 152 // TODO(dalecurtis): Disabled because loop is flaky. http://crbug.com/134021 |
| 152 // IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoLoopTest) { | 153 // IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoLoopTest) { |
| 153 // RunLayoutTest("video-loop.html"); | 154 // RunLayoutTest("video-loop.html"); |
| 154 // } | 155 // } |
| 155 | 156 |
| 156 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoNoAutoplayTest) { | 157 IN_PROC_BROWSER_TEST_F(MediaLayoutTest, VideoNoAutoplayTest) { |
| 157 RunLayoutTest("video-no-autoplay.html"); | 158 RunLayoutTest("video-no-autoplay.html"); |
| 158 } | 159 } |
| OLD | NEW |