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

Side by Side Diff: chrome/browser/content_settings/content_settings_browsertest.cc

Issue 17198011: Wrap Pepper CDM Content Settings code in defined(ENABLE_PEPPER_CDMS). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « no previous file | chrome/browser/plugins/plugin_info_message_filter.cc » ('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) 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/content_settings/cookie_settings.h" 9 #include "chrome/browser/content_settings/cookie_settings.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 #if defined(OS_WIN) 482 #if defined(OS_WIN)
483 const std::wstring external_clear_key_mime_type = 483 const std::wstring external_clear_key_mime_type =
484 ASCIIToWide(kExternalClearKeyMimeType); 484 ASCIIToWide(kExternalClearKeyMimeType);
485 const char kLibraryName[] = "clearkeycdmadapter.dll"; 485 const char kLibraryName[] = "clearkeycdmadapter.dll";
486 #else // !defined(OS_WIN) 486 #else // !defined(OS_WIN)
487 const char* external_clear_key_mime_type = kExternalClearKeyMimeType; 487 const char* external_clear_key_mime_type = kExternalClearKeyMimeType;
488 #if defined(OS_MACOSX) 488 #if defined(OS_MACOSX)
489 const char kLibraryName[] = "clearkeycdmadapter.plugin"; 489 const char kLibraryName[] = "clearkeycdmadapter.plugin";
490 #elif defined(OS_POSIX) 490 #elif defined(OS_POSIX)
491 const char kLibraryName[] = "libclearkeycdmadapter.so"; 491 const char kLibraryName[] = "libclearkeycdmadapter.so";
492 #endif 492 #endif // defined(OS_MACOSX)
493 #endif // defined(OS_WIN) 493 #endif // defined(OS_WIN)
494 494
495 // Append the switch to register the External Clear Key CDM. 495 // Append the switch to register the External Clear Key CDM.
496 base::FilePath plugin_dir; 496 base::FilePath plugin_dir;
497 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); 497 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
498 base::FilePath plugin_lib = plugin_dir.AppendASCII(kLibraryName); 498 base::FilePath plugin_lib = plugin_dir.AppendASCII(kLibraryName);
499 EXPECT_TRUE(file_util::PathExists(plugin_lib)); 499 EXPECT_TRUE(file_util::PathExists(plugin_lib));
500 base::FilePath::StringType pepper_plugin = plugin_lib.value(); 500 base::FilePath::StringType pepper_plugin = plugin_lib.value();
501 pepper_plugin.append(FILE_PATH_LITERAL( 501 pepper_plugin.append(FILE_PATH_LITERAL(
502 "#Clear Key CDM#Clear Key CDM 0.1.0.0#0.1.0.0;")); 502 "#Clear Key CDM#Clear Key CDM 0.1.0.0#0.1.0.0;"));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 IN_PROC_BROWSER_TEST_F(PepperContentSettingsTest, PluginSpecialCases) { 564 IN_PROC_BROWSER_TEST_F(PepperContentSettingsTest, PluginSpecialCases) {
565 HostContentSettingsMap* content_settings = 565 HostContentSettingsMap* content_settings =
566 browser()->profile()->GetHostContentSettingsMap(); 566 browser()->profile()->GetHostContentSettingsMap();
567 567
568 // First, verify that this plugin can be loaded. 568 // First, verify that this plugin can be loaded.
569 content_settings->SetDefaultContentSetting( 569 content_settings->SetDefaultContentSetting(
570 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW); 570 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
571 571
572 #if defined(ENABLE_PEPPER_CDMS) 572 #if defined(ENABLE_PEPPER_CDMS)
573 RunLoadPepperPluginTest(kExternalClearKeyMimeType, true); 573 RunLoadPepperPluginTest(kExternalClearKeyMimeType, true);
574 #endif 574 #endif // defined(ENABLE_PEPPER_CDMS)
575 575
576 // Next, test behavior when plug-ins are blocked. 576 // Next, test behavior when plug-ins are blocked.
577 content_settings->SetDefaultContentSetting( 577 content_settings->SetDefaultContentSetting(
578 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); 578 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
579 579
580 #if defined(ENABLE_PEPPER_CDMS) 580 #if defined(ENABLE_PEPPER_CDMS)
581 // The plugin we loaded above does not load now. 581 // The plugin we loaded above does not load now.
582 RunLoadPepperPluginTest(kExternalClearKeyMimeType, false); 582 RunLoadPepperPluginTest(kExternalClearKeyMimeType, false);
583 583
584 #if defined(WIDEVINE_CDM_AVAILABLE) 584 #if defined(WIDEVINE_CDM_AVAILABLE)
585 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); 585 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true);
586 #endif 586 #endif // defined(WIDEVINE_CDM_AVAILABLE)
587 #endif // defined(ENABLE_PEPPER_CDMS) 587 #endif // defined(ENABLE_PEPPER_CDMS)
588 588
589 #if !defined(DISABLE_NACL) 589 #if !defined(DISABLE_NACL)
590 RunLoadPepperPluginTest("application/x-nacl", true); 590 RunLoadPepperPluginTest("application/x-nacl", true);
591 #endif 591 #endif // !defined(DISABLE_NACL)
592 592
593 // Finally, test behavior when (just) JavaScript is blocked. 593 // Finally, test behavior when (just) JavaScript is blocked.
594 content_settings->SetDefaultContentSetting( 594 content_settings->SetDefaultContentSetting(
595 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW); 595 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW);
596 content_settings->SetDefaultContentSetting( 596 content_settings->SetDefaultContentSetting(
597 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); 597 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK);
598 598
599 #if defined(ENABLE_PEPPER_CDMS) 599 #if defined(ENABLE_PEPPER_CDMS)
600 // This plugin has no special behavior and does not require JavaScript. 600 // This plugin has no special behavior and does not require JavaScript.
601 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false); 601 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false);
602 602
603 #if defined(WIDEVINE_CDM_AVAILABLE) 603 #if defined(WIDEVINE_CDM_AVAILABLE)
604 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); 604 RunJavaScriptBlockedTest("load_widevine_no_js.html", true);
605 #endif 605 #endif // defined(WIDEVINE_CDM_AVAILABLE)
606 #endif // defined(ENABLE_PEPPER_CDMS) 606 #endif // defined(ENABLE_PEPPER_CDMS)
607 607
608 #if !defined(DISABLE_NACL) 608 #if !defined(DISABLE_NACL)
609 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); 609 RunJavaScriptBlockedTest("load_nacl_no_js.html", true);
610 #endif 610 #endif // !defined(DISABLE_NACL)
611 } 611 }
612 612
613 #endif // defined(ENABLE_PLUGINS) 613 #endif // defined(ENABLE_PLUGINS)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/plugins/plugin_info_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698