Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1069)

Side by Side Diff: content/browser/media/media_source_browsertest.cc

Issue 27230004: Do not run MSE related tests when MSE is not available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/media/encrypted_media_browsertest.cc ('k') | content/child/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/command_line.h" 5 #include "base/command_line.h"
6 #include "content/browser/media/media_browsertest.h" 6 #include "content/browser/media/media_browsertest.h"
7 #include "content/public/common/content_switches.h" 7 #include "content/public/common/content_switches.h"
8 #if defined(OS_ANDROID)
9 #include "base/android/build_info.h"
10 #endif
8 11
9 // Common media types. 12 // Common media types.
10 static const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; 13 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
11 static const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; 14 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\"";
12 static const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; 15 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\"";
13 16
14 namespace content { 17 namespace content {
15 18
19 // MSE is available on all desktop platforms and on Android 4.1 and later.
20 static bool IsMSESupported() {
21 #if defined(OS_ANDROID)
22 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) {
23 LOG(INFO) << "MSE is only supported in Android 4.1 and later.";
24 return false;
25 }
26 #endif // defined(OS_ANDROID)
27 return true;
28 }
29
16 class MediaSourceTest : public content::MediaBrowserTest { 30 class MediaSourceTest : public content::MediaBrowserTest {
17 public: 31 public:
18 void TestSimplePlayback(const char* media_file, const char* media_type, 32 void TestSimplePlayback(const char* media_file, const char* media_type,
19 const char* expectation) { 33 const char* expectation) {
34 if (!IsMSESupported()) {
35 LOG(INFO) << "Skipping test - MSE not supported.";
36 return;
37 }
38
20 std::vector<StringPair> query_params; 39 std::vector<StringPair> query_params;
21 query_params.push_back(std::make_pair("mediafile", media_file)); 40 query_params.push_back(std::make_pair("mediafile", media_file));
22 query_params.push_back(std::make_pair("mediatype", media_type)); 41 query_params.push_back(std::make_pair("mediatype", media_type));
23 RunMediaTestPage("media_source_player.html", &query_params, expectation, 42 RunMediaTestPage("media_source_player.html", &query_params, expectation,
24 true); 43 true);
25 } 44 }
26 45
27 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
28 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 47 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
29 command_line->AppendSwitch( 48 command_line->AppendSwitch(
(...skipping 14 matching lines...) Expand all
44 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded); 63 TestSimplePlayback("bear-320x240-audio-only.webm", kWebMAudioOnly, kEnded);
45 } 64 }
46 65
47 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) { 66 IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) {
48 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError); 67 TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly, kError);
49 } 68 }
50 69
51 // Flaky test crbug.com/246308 70 // Flaky test crbug.com/246308
52 // Test changed to skip checks resulting in flakiness. Proper fix still needed. 71 // Test changed to skip checks resulting in flakiness. Proper fix still needed.
53 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) { 72 IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) {
73 if (!IsMSESupported()) {
74 LOG(INFO) << "Skipping test - MSE not supported.";
75 return;
76 }
54 RunMediaTestPage("mse_config_change.html", NULL, kEnded, true); 77 RunMediaTestPage("mse_config_change.html", NULL, kEnded, true);
55 } 78 }
56 79
57 } // namespace content 80 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/encrypted_media_browsertest.cc ('k') | content/child/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698