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

Side by Side Diff: content/browser/plugin_browsertest.cc

Issue 645203002: Block NPAPI plugins by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing test file Created 6 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
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/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/loader/resource_dispatcher_host_impl.h" 10 #include "content/browser/loader/resource_dispatcher_host_impl.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 class PluginTest : public ContentBrowserTest { 48 class PluginTest : public ContentBrowserTest {
49 protected: 49 protected:
50 PluginTest() {} 50 PluginTest() {}
51 51
52 virtual void SetUpCommandLine(CommandLine* command_line) override { 52 virtual void SetUpCommandLine(CommandLine* command_line) override {
53 // Some NPAPI tests schedule garbage collection to force object tear-down. 53 // Some NPAPI tests schedule garbage collection to force object tear-down.
54 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc"); 54 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc");
55 55
56 #if defined(OS_WIN) || defined(OS_MACOSX)
57 command_line->AppendSwitch(switches::kEnableNpapi);
58 #endif
56 #if defined(OS_WIN) 59 #if defined(OS_WIN)
57 const testing::TestInfo* const test_info = 60 const testing::TestInfo* const test_info =
58 testing::UnitTest::GetInstance()->current_test_info(); 61 testing::UnitTest::GetInstance()->current_test_info();
59 if (strcmp(test_info->name(), "MediaPlayerNew") == 0) { 62 if (strcmp(test_info->name(), "MediaPlayerNew") == 0) {
60 // The installer adds our process names to the registry key below. Since 63 // The installer adds our process names to the registry key below. Since
61 // the installer might not have run on this machine, add it manually. 64 // the installer might not have run on this machine, add it manually.
62 base::win::RegKey regkey; 65 base::win::RegKey regkey;
63 if (regkey.Open(HKEY_LOCAL_MACHINE, 66 if (regkey.Open(HKEY_LOCAL_MACHINE,
64 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList", 67 L"Software\\Microsoft\\MediaPlayer\\ShimInclusionList",
65 KEY_WRITE) == ERROR_SUCCESS) { 68 KEY_WRITE) == ERROR_SUCCESS) {
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 ResourceDispatcherHostDelegate* old_delegate = 561 ResourceDispatcherHostDelegate* old_delegate =
559 ResourceDispatcherHostImpl::Get()->delegate(); 562 ResourceDispatcherHostImpl::Get()->delegate();
560 ResourceDispatcherHostImpl::Get()->SetDelegate(&test_delegate); 563 ResourceDispatcherHostImpl::Get()->SetDelegate(&test_delegate);
561 LoadAndWait(url); 564 LoadAndWait(url);
562 test_delegate.WaitForPluginRequest(); 565 test_delegate.WaitForPluginRequest();
563 ASSERT_TRUE(test_delegate.found_cookie()); 566 ASSERT_TRUE(test_delegate.found_cookie());
564 ResourceDispatcherHostImpl::Get()->SetDelegate(old_delegate); 567 ResourceDispatcherHostImpl::Get()->SetDelegate(old_delegate);
565 } 568 }
566 569
567 } // namespace content 570 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698