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

Side by Side Diff: chrome/browser/media/encrypted_media_browsertest.cc

Issue 2681383003: media: Add a web preference to enable encrypted media (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "chrome/browser/media/media_browsertest.h" 12 #include "chrome/browser/media/media_browsertest.h"
13 #include "chrome/browser/media/test_license_server.h" 13 #include "chrome/browser/media/test_license_server.h"
14 #include "chrome/browser/media/wv_test_license_server_config.h" 14 #include "chrome/browser/media/wv_test_license_server_config.h"
15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
17 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h"
18 #include "chrome/test/base/test_launcher_utils.h" 20 #include "chrome/test/base/test_launcher_utils.h"
21 #include "components/prefs/pref_service.h"
19 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
20 #include "content/public/test/browser_test_utils.h" 23 #include "content/public/test/browser_test_utils.h"
21 #include "media/base/media_switches.h" 24 #include "media/base/media_switches.h"
22 #include "ppapi/features/features.h" 25 #include "ppapi/features/features.h"
23 #include "testing/gtest/include/gtest/gtest-spi.h" 26 #include "testing/gtest/include/gtest/gtest-spi.h"
24 27
25 #if defined(OS_ANDROID) 28 #if defined(OS_ANDROID)
26 #include "base/android/build_info.h" 29 #include "base/android/build_info.h"
27 #endif 30 #endif
28 31
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); 406 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem()));
404 query_params.push_back(std::make_pair("runEncrypted", "1")); 407 query_params.push_back(std::make_pair("runEncrypted", "1"));
405 query_params.push_back( 408 query_params.push_back(
406 std::make_pair("videoFormat", ConvertContainerFormat(video_format))); 409 std::make_pair("videoFormat", ConvertContainerFormat(video_format)));
407 query_params.push_back( 410 query_params.push_back(
408 std::make_pair("audioFormat", ConvertContainerFormat(audio_format))); 411 std::make_pair("audioFormat", ConvertContainerFormat(audio_format)));
409 RunEncryptedMediaTestPage("mse_different_containers.html", 412 RunEncryptedMediaTestPage("mse_different_containers.html",
410 CurrentKeySystem(), query_params, kEnded); 413 CurrentKeySystem(), query_params, kEnded);
411 } 414 }
412 415
416 void DisableEncryptedMedia() {
417 PrefService* pref_service = browser()->profile()->GetPrefs();
418 pref_service->SetBoolean(prefs::kWebKitEncryptedMediaEnabled, false);
419 }
420
413 protected: 421 protected:
414 void SetUpCommandLine(base::CommandLine* command_line) override { 422 void SetUpCommandLine(base::CommandLine* command_line) override {
415 EncryptedMediaTestBase::SetUpCommandLine(command_line); 423 EncryptedMediaTestBase::SetUpCommandLine(command_line);
416 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); 424 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line);
417 } 425 }
418 }; 426 };
419 427
420 using ::testing::Combine; 428 using ::testing::Combine;
421 using ::testing::Values; 429 using ::testing::Values;
422 430
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } 532 }
525 533
526 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { 534 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) {
527 if (!IsPlayBackPossible(CurrentKeySystem())) { 535 if (!IsPlayBackPossible(CurrentKeySystem())) {
528 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; 536 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback.";
529 return; 537 return;
530 } 538 }
531 TestFrameSizeChange(); 539 TestFrameSizeChange();
532 } 540 }
533 541
542 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, EncryptedMediaDisabled) {
543 DisableEncryptedMedia();
544 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
545 kWebMVorbisAudioOnly, CurrentKeySystem(),
546 CurrentSourceType(), kNoSessionToLoad, false,
547 PlayCount::ONCE, kEmeNotSupportedError);
548 }
549
534 #if defined(USE_PROPRIETARY_CODECS) 550 #if defined(USE_PROPRIETARY_CODECS)
535 // Crashes on Mac only. http://crbug.com/621857 551 // Crashes on Mac only. http://crbug.com/621857
536 #if defined(OS_MACOSX) 552 #if defined(OS_MACOSX)
537 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4 553 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4
538 #else 554 #else
539 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4 555 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4
540 #endif 556 #endif
541 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) { 557 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) {
542 // MP4 without MSE is not support yet, http://crbug.com/170793. 558 // MP4 without MSE is not support yet, http://crbug.com/170793.
543 if (CurrentSourceType() != MSE) { 559 if (CurrentSourceType() != MSE) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { 682 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) {
667 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); 683 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded);
668 } 684 }
669 685
670 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { 686 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) {
671 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, 687 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession,
672 kEmeSessionNotFound); 688 kEmeSessionNotFound);
673 } 689 }
674 690
675 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 691 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/ui/prefs/prefs_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698