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

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

Issue 2409423002: Move ENABLE_PEPPER_CDMS to a buildflag header. (Closed)
Patch Set: Fix and format Created 4 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
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/load_library_perf_test.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 "base/test/scoped_feature_list.h" 9 #include "base/test/scoped_feature_list.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 27 matching lines...) Expand all
38 #include "content/public/common/content_constants.h" 38 #include "content/public/common/content_constants.h"
39 #include "content/public/common/content_switches.h" 39 #include "content/public/common/content_switches.h"
40 #include "content/public/common/mhtml_generation_params.h" 40 #include "content/public/common/mhtml_generation_params.h"
41 #include "content/public/test/browser_test_utils.h" 41 #include "content/public/test/browser_test_utils.h"
42 #include "content/public/test/ppapi_test_utils.h" 42 #include "content/public/test/ppapi_test_utils.h"
43 #include "content/public/test/test_utils.h" 43 #include "content/public/test/test_utils.h"
44 #include "media/cdm/cdm_paths.h" 44 #include "media/cdm/cdm_paths.h"
45 #include "net/dns/mock_host_resolver.h" 45 #include "net/dns/mock_host_resolver.h"
46 #include "net/test/embedded_test_server/embedded_test_server.h" 46 #include "net/test/embedded_test_server/embedded_test_server.h"
47 #include "net/test/url_request/url_request_mock_http_job.h" 47 #include "net/test/url_request/url_request_mock_http_job.h"
48 #include "ppapi/features/features.h"
48 #include "ppapi/shared_impl/ppapi_switches.h" 49 #include "ppapi/shared_impl/ppapi_switches.h"
49 #include "testing/gmock/include/gmock/gmock.h" 50 #include "testing/gmock/include/gmock/gmock.h"
50 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 51 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
51 52
52 #if defined(OS_MACOSX) 53 #if defined(OS_MACOSX)
53 #include "base/mac/scoped_nsautorelease_pool.h" 54 #include "base/mac/scoped_nsautorelease_pool.h"
54 #endif 55 #endif
55 56
56 #if defined(ENABLE_PEPPER_CDMS) 57 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
57 #include "chrome/browser/media/pepper_cdm_test_helper.h" 58 #include "chrome/browser/media/pepper_cdm_test_helper.h"
58 #endif 59 #endif
59 60
60 using content::BrowserThread; 61 using content::BrowserThread;
61 using net::URLRequestMockHTTPJob; 62 using net::URLRequestMockHTTPJob;
62 63
63 namespace { 64 namespace {
64 65
65 const LocalSharedObjectsContainer* GetSiteSettingsCookieContainer( 66 const LocalSharedObjectsContainer* GetSiteSettingsCookieContainer(
66 Browser* browser) { 67 Browser* browser) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 protected: 350 protected:
350 void SetUpCommandLine(base::CommandLine* command_line) override { 351 void SetUpCommandLine(base::CommandLine* command_line) override {
351 ASSERT_TRUE(ppapi::RegisterFlashTestPlugin(command_line)); 352 ASSERT_TRUE(ppapi::RegisterFlashTestPlugin(command_line));
352 353
353 #if !defined(DISABLE_NACL) 354 #if !defined(DISABLE_NACL)
354 // Ensure NaCl can run. 355 // Ensure NaCl can run.
355 command_line->AppendSwitch(switches::kEnableNaCl); 356 command_line->AppendSwitch(switches::kEnableNaCl);
356 #endif 357 #endif
357 } 358 }
358 359
359 #if defined(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) 360 #if BUILDFLAG(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE)
360 // Since the CDM is bundled and registered through the component updater, 361 // Since the CDM is bundled and registered through the component updater,
361 // we must re-enable the component updater. 362 // we must re-enable the component updater.
362 void SetUpDefaultCommandLine(base::CommandLine* command_line) override { 363 void SetUpDefaultCommandLine(base::CommandLine* command_line) override {
363 base::CommandLine default_command_line(base::CommandLine::NO_PROGRAM); 364 base::CommandLine default_command_line(base::CommandLine::NO_PROGRAM);
364 InProcessBrowserTest::SetUpDefaultCommandLine(&default_command_line); 365 InProcessBrowserTest::SetUpDefaultCommandLine(&default_command_line);
365 test_launcher_utils::RemoveCommandLineSwitch( 366 test_launcher_utils::RemoveCommandLineSwitch(
366 default_command_line, switches::kDisableComponentUpdate, command_line); 367 default_command_line, switches::kDisableComponentUpdate, command_line);
367 } 368 }
368 #endif // defined(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) 369 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE)
369 370
370 void SetUpInProcessBrowserTestFixture() override { 371 void SetUpInProcessBrowserTestFixture() override {
371 ContentSettingsTest::SetUpInProcessBrowserTestFixture(); 372 ContentSettingsTest::SetUpInProcessBrowserTestFixture();
372 373
373 // Disable the HTML by Default feature so we can test blocked plugins. 374 // Disable the HTML by Default feature so we can test blocked plugins.
374 feature_list.InitAndDisableFeature(features::kPreferHtmlOverPlugins); 375 feature_list.InitAndDisableFeature(features::kPreferHtmlOverPlugins);
375 } 376 }
376 377
377 void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) { 378 void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) {
378 const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded"; 379 const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded";
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 491
491 // The following tests verify that Pepper plugins that use JavaScript settings 492 // The following tests verify that Pepper plugins that use JavaScript settings
492 // instead of Plugins settings still work when Plugins are blocked. 493 // instead of Plugins settings still work when Plugins are blocked.
493 494
494 // The plugin successfully loaded above is blocked. 495 // The plugin successfully loaded above is blocked.
495 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, 496 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
496 BlockedFlash) { 497 BlockedFlash) {
497 RunLoadPepperPluginTest(content::kFlashPluginSwfMimeType, false); 498 RunLoadPepperPluginTest(content::kFlashPluginSwfMimeType, false);
498 } 499 }
499 500
500 #if defined(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) && \ 501 #if BUILDFLAG(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) && \
501 !defined(OS_CHROMEOS) 502 !defined(OS_CHROMEOS)
502 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, 503 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
503 WidevineCdm) { 504 WidevineCdm) {
504 // Check that Widevine CDM is available and registered. 505 // Check that Widevine CDM is available and registered.
505 base::FilePath adapter_path = 506 base::FilePath adapter_path =
506 GetPepperCdmPath(kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName); 507 GetPepperCdmPath(kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName);
507 EXPECT_TRUE(base::PathExists(adapter_path)) << adapter_path.MaybeAsASCII(); 508 EXPECT_TRUE(base::PathExists(adapter_path)) << adapter_path.MaybeAsASCII();
508 EXPECT_TRUE(IsPepperCdmRegistered(kWidevineCdmPluginMimeType)); 509 EXPECT_TRUE(IsPepperCdmRegistered(kWidevineCdmPluginMimeType));
509 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); 510 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true);
510 } 511 }
511 #endif // defined(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) && 512 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) &&
512 // !defined(OS_CHROMEOS) 513 // !defined(OS_CHROMEOS)
513 514
514 #if !defined(DISABLE_NACL) 515 #if !defined(DISABLE_NACL)
515 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, 516 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest,
516 NaCl) { 517 NaCl) {
517 RunLoadPepperPluginTest("application/x-nacl", true); 518 RunLoadPepperPluginTest("application/x-nacl", true);
518 } 519 }
519 #endif // !defined(DISABLE_NACL) 520 #endif // !defined(DISABLE_NACL)
520 521
521 // The following tests verify that those same Pepper plugins do not work when 522 // The following tests verify that those same Pepper plugins do not work when
522 // JavaScript is blocked. 523 // JavaScript is blocked.
523 524
524 // A plugin with no special behavior is not blocked when JavaScript is blocked. 525 // A plugin with no special behavior is not blocked when JavaScript is blocked.
525 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, 526 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
526 Flash) { 527 Flash) {
527 RunJavaScriptBlockedTest("load_flash_no_js.html", false); 528 RunJavaScriptBlockedTest("load_flash_no_js.html", false);
528 } 529 }
529 530
530 #if defined(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) 531 #if BUILDFLAG(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE)
531 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, 532 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
532 WidevineCdm) { 533 WidevineCdm) {
533 // Check that Widevine CDM is available and registered. 534 // Check that Widevine CDM is available and registered.
534 base::FilePath adapter_path = 535 base::FilePath adapter_path =
535 GetPepperCdmPath(kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName); 536 GetPepperCdmPath(kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName);
536 EXPECT_TRUE(base::PathExists(adapter_path)) << adapter_path.MaybeAsASCII(); 537 EXPECT_TRUE(base::PathExists(adapter_path)) << adapter_path.MaybeAsASCII();
537 EXPECT_TRUE(IsPepperCdmRegistered(kWidevineCdmPluginMimeType)); 538 EXPECT_TRUE(IsPepperCdmRegistered(kWidevineCdmPluginMimeType));
538 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); 539 RunJavaScriptBlockedTest("load_widevine_no_js.html", true);
539 } 540 }
540 #endif // defined(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE) 541 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) && defined(WIDEVINE_CDM_AVAILABLE)
541 542
542 #if !defined(DISABLE_NACL) 543 #if !defined(DISABLE_NACL)
543 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, 544 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest,
544 NaCl) { 545 NaCl) {
545 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); 546 RunJavaScriptBlockedTest("load_nacl_no_js.html", true);
546 } 547 }
547 #endif // !defined(DISABLE_NACL) 548 #endif // !defined(DISABLE_NACL)
548 549
549 #endif // defined(ENABLE_PLUGINS) 550 #endif // defined(ENABLE_PLUGINS)
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/load_library_perf_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698