| OLD | NEW |
| 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/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/content_settings/cookie_settings.h" | 10 #include "chrome/browser/content_settings/cookie_settings.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 class ContentSettingsTest : public InProcessBrowserTest { | 47 class ContentSettingsTest : public InProcessBrowserTest { |
| 48 public: | 48 public: |
| 49 ContentSettingsTest() | 49 ContentSettingsTest() |
| 50 : https_server_(net::SpawnedTestServer::TYPE_HTTPS, | 50 : https_server_(net::SpawnedTestServer::TYPE_HTTPS, |
| 51 net::SpawnedTestServer::SSLOptions( | 51 net::SpawnedTestServer::SSLOptions( |
| 52 net::SpawnedTestServer::SSLOptions::CERT_OK), | 52 net::SpawnedTestServer::SSLOptions::CERT_OK), |
| 53 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { | 53 base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))) { |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual void SetUpOnMainThread() override { | 56 void SetUpOnMainThread() override { |
| 57 BrowserThread::PostTask( | 57 BrowserThread::PostTask( |
| 58 BrowserThread::IO, FROM_HERE, | 58 BrowserThread::IO, FROM_HERE, |
| 59 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 59 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Check the cookie for the given URL in an incognito window. | 62 // Check the cookie for the given URL in an incognito window. |
| 63 void CookieCheckIncognitoWindow(const GURL& url, bool cookies_enabled) { | 63 void CookieCheckIncognitoWindow(const GURL& url, bool cookies_enabled) { |
| 64 ASSERT_TRUE(content::GetCookies(browser()->profile(), url).empty()); | 64 ASSERT_TRUE(content::GetCookies(browser()->profile(), url).empty()); |
| 65 | 65 |
| 66 Browser* incognito = CreateIncognitoBrowser(); | 66 Browser* incognito = CreateIncognitoBrowser(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 // On Aura NPAPI only works on Windows. | 294 // On Aura NPAPI only works on Windows. |
| 295 #if !defined(USE_AURA) || defined(OS_WIN) | 295 #if !defined(USE_AURA) || defined(OS_WIN) |
| 296 | 296 |
| 297 class ClickToPlayPluginTest : public ContentSettingsTest { | 297 class ClickToPlayPluginTest : public ContentSettingsTest { |
| 298 public: | 298 public: |
| 299 ClickToPlayPluginTest() {} | 299 ClickToPlayPluginTest() {} |
| 300 | 300 |
| 301 #if defined(OS_MACOSX) | 301 #if defined(OS_MACOSX) |
| 302 virtual void SetUpCommandLine(CommandLine* command_line) override { | 302 void SetUpCommandLine(CommandLine* command_line) override { |
| 303 base::FilePath plugin_dir; | 303 base::FilePath plugin_dir; |
| 304 PathService::Get(base::DIR_MODULE, &plugin_dir); | 304 PathService::Get(base::DIR_MODULE, &plugin_dir); |
| 305 plugin_dir = plugin_dir.AppendASCII("plugins"); | 305 plugin_dir = plugin_dir.AppendASCII("plugins"); |
| 306 // The plugins directory isn't read by default on the Mac, so it needs to be | 306 // The plugins directory isn't read by default on the Mac, so it needs to be |
| 307 // explicitly registered. | 307 // explicitly registered. |
| 308 command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir); | 308 command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir); |
| 309 } | 309 } |
| 310 #endif | 310 #endif |
| 311 }; | 311 }; |
| 312 | 312 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 } | 463 } |
| 464 | 464 |
| 465 #endif // !defined(USE_AURA) || defined(OS_WIN) | 465 #endif // !defined(USE_AURA) || defined(OS_WIN) |
| 466 | 466 |
| 467 #if defined(ENABLE_PLUGINS) | 467 #if defined(ENABLE_PLUGINS) |
| 468 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { | 468 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { |
| 469 protected: | 469 protected: |
| 470 static const char* const kExternalClearKeyMimeType; | 470 static const char* const kExternalClearKeyMimeType; |
| 471 | 471 |
| 472 // Registers any CDM plugins not registered by default. | 472 // Registers any CDM plugins not registered by default. |
| 473 virtual void SetUpCommandLine(CommandLine* command_line) override { | 473 void SetUpCommandLine(CommandLine* command_line) override { |
| 474 #if defined(ENABLE_PEPPER_CDMS) | 474 #if defined(ENABLE_PEPPER_CDMS) |
| 475 // Platform-specific filename relative to the chrome executable. | 475 // Platform-specific filename relative to the chrome executable. |
| 476 #if defined(OS_WIN) | 476 #if defined(OS_WIN) |
| 477 const char kLibraryName[] = "clearkeycdmadapter.dll"; | 477 const char kLibraryName[] = "clearkeycdmadapter.dll"; |
| 478 #else // !defined(OS_WIN) | 478 #else // !defined(OS_WIN) |
| 479 #if defined(OS_MACOSX) | 479 #if defined(OS_MACOSX) |
| 480 const char kLibraryName[] = "clearkeycdmadapter.plugin"; | 480 const char kLibraryName[] = "clearkeycdmadapter.plugin"; |
| 481 #elif defined(OS_POSIX) | 481 #elif defined(OS_POSIX) |
| 482 const char kLibraryName[] = "libclearkeycdmadapter.so"; | 482 const char kLibraryName[] = "libclearkeycdmadapter.so"; |
| 483 #endif // defined(OS_MACOSX) | 483 #endif // defined(OS_MACOSX) |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 } | 611 } |
| 612 }; | 612 }; |
| 613 | 613 |
| 614 const char* const | 614 const char* const |
| 615 PepperContentSettingsSpecialCasesTest::kExternalClearKeyMimeType = | 615 PepperContentSettingsSpecialCasesTest::kExternalClearKeyMimeType = |
| 616 "application/x-ppapi-clearkey-cdm"; | 616 "application/x-ppapi-clearkey-cdm"; |
| 617 | 617 |
| 618 class PepperContentSettingsSpecialCasesPluginsBlockedTest | 618 class PepperContentSettingsSpecialCasesPluginsBlockedTest |
| 619 : public PepperContentSettingsSpecialCasesTest { | 619 : public PepperContentSettingsSpecialCasesTest { |
| 620 public: | 620 public: |
| 621 virtual void SetUpOnMainThread() override { | 621 void SetUpOnMainThread() override { |
| 622 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread(); | 622 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread(); |
| 623 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 623 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
| 624 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); | 624 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); |
| 625 } | 625 } |
| 626 }; | 626 }; |
| 627 | 627 |
| 628 class PepperContentSettingsSpecialCasesJavaScriptBlockedTest | 628 class PepperContentSettingsSpecialCasesJavaScriptBlockedTest |
| 629 : public PepperContentSettingsSpecialCasesTest { | 629 : public PepperContentSettingsSpecialCasesTest { |
| 630 public: | 630 public: |
| 631 virtual void SetUpOnMainThread() override { | 631 void SetUpOnMainThread() override { |
| 632 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread(); | 632 PepperContentSettingsSpecialCasesTest::SetUpOnMainThread(); |
| 633 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 633 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
| 634 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW); | 634 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW); |
| 635 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 635 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
| 636 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); | 636 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); |
| 637 } | 637 } |
| 638 }; | 638 }; |
| 639 | 639 |
| 640 #if defined(ENABLE_PEPPER_CDMS) | 640 #if defined(ENABLE_PEPPER_CDMS) |
| 641 // A sanity check to verify that the plugin that is used as a baseline below | 641 // A sanity check to verify that the plugin that is used as a baseline below |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 #if defined(OS_WIN) && defined(USE_ASH) | 727 #if defined(OS_WIN) && defined(USE_ASH) |
| 728 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 728 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 729 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 729 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 730 return; | 730 return; |
| 731 #endif | 731 #endif |
| 732 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 732 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
| 733 } | 733 } |
| 734 #endif // !defined(DISABLE_NACL) | 734 #endif // !defined(DISABLE_NACL) |
| 735 | 735 |
| 736 #endif // defined(ENABLE_PLUGINS) | 736 #endif // defined(ENABLE_PLUGINS) |
| OLD | NEW |