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

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

Issue 2676633006: media: Add a web preference to enable encrypted media (Closed)
Patch Set: use a new pref 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 "media/media_features.h" 25 #include "media/media_features.h"
23 #include "ppapi/features/features.h" 26 #include "ppapi/features/features.h"
24 #include "testing/gtest/include/gtest/gtest-spi.h" 27 #include "testing/gtest/include/gtest/gtest-spi.h"
25 28
26 #if defined(OS_ANDROID) 29 #if defined(OS_ANDROID)
27 #include "base/android/build_info.h" 30 #include "base/android/build_info.h"
28 #endif 31 #endif
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); 411 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem()));
409 query_params.push_back(std::make_pair("runEncrypted", "1")); 412 query_params.push_back(std::make_pair("runEncrypted", "1"));
410 query_params.push_back( 413 query_params.push_back(
411 std::make_pair("videoFormat", ConvertContainerFormat(video_format))); 414 std::make_pair("videoFormat", ConvertContainerFormat(video_format)));
412 query_params.push_back( 415 query_params.push_back(
413 std::make_pair("audioFormat", ConvertContainerFormat(audio_format))); 416 std::make_pair("audioFormat", ConvertContainerFormat(audio_format)));
414 RunEncryptedMediaTestPage("mse_different_containers.html", 417 RunEncryptedMediaTestPage("mse_different_containers.html",
415 CurrentKeySystem(), query_params, kEnded); 418 CurrentKeySystem(), query_params, kEnded);
416 } 419 }
417 420
421 void DisableEncryptedMedia() {
422 PrefService* pref_service = browser()->profile()->GetPrefs();
423 pref_service->SetBoolean(prefs::kWebKitEncryptedMediaEnabled, false);
424 }
425
418 protected: 426 protected:
419 void SetUpCommandLine(base::CommandLine* command_line) override { 427 void SetUpCommandLine(base::CommandLine* command_line) override {
420 EncryptedMediaTestBase::SetUpCommandLine(command_line); 428 EncryptedMediaTestBase::SetUpCommandLine(command_line);
421 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); 429 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line);
422 } 430 }
423 }; 431 };
424 432
425 using ::testing::Combine; 433 using ::testing::Combine;
426 using ::testing::Values; 434 using ::testing::Values;
427 435
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 537 }
530 538
531 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { 539 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) {
532 if (!IsPlayBackPossible(CurrentKeySystem())) { 540 if (!IsPlayBackPossible(CurrentKeySystem())) {
533 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; 541 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback.";
534 return; 542 return;
535 } 543 }
536 TestFrameSizeChange(); 544 TestFrameSizeChange();
537 } 545 }
538 546
547 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, EncryptedMediaDisabled) {
548 DisableEncryptedMedia();
549 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
550 kWebMVorbisAudioOnly, CurrentKeySystem(),
551 CurrentSourceType(), kNoSessionToLoad, false,
552 PlayCount::ONCE, kEmeNotSupportedError);
553 }
554
539 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 555 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
540 // Crashes on Mac only. http://crbug.com/621857 556 // Crashes on Mac only. http://crbug.com/621857
541 #if defined(OS_MACOSX) 557 #if defined(OS_MACOSX)
542 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4 558 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4
543 #else 559 #else
544 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4 560 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4
545 #endif 561 #endif
546 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) { 562 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) {
547 // MP4 without MSE is not support yet, http://crbug.com/170793. 563 // MP4 without MSE is not support yet, http://crbug.com/170793.
548 if (CurrentSourceType() != MSE) { 564 if (CurrentSourceType() != MSE) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, 692 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession,
677 kEmeSessionNotFound); 693 kEmeSessionNotFound);
678 } 694 }
679 695
680 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, VerifyCdmHostTest) { 696 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, VerifyCdmHostTest) {
681 TestNonPlaybackCases(kExternalClearKeyVerifyCdmHostTestKeySystem, 697 TestNonPlaybackCases(kExternalClearKeyVerifyCdmHostTestKeySystem,
682 kUnitTestSuccess); 698 kUnitTestSuccess);
683 } 699 }
684 700
685 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 701 #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