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