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/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/synchronization/waitable_event_watcher.h" | 9 #include "base/synchronization/waitable_event_watcher.h" |
10 #include "content/browser/plugin_data_remover_impl.h" | 10 #include "content/browser/plugin_data_remover_impl.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class PluginDataRemoverTest : public ContentBrowserTest { | 23 class PluginDataRemoverTest : public ContentBrowserTest { |
24 public: | 24 public: |
25 PluginDataRemoverTest() {} | 25 PluginDataRemoverTest() {} |
26 | 26 |
27 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { | 27 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { |
28 MessageLoop::current()->Quit(); | 28 MessageLoop::current()->Quit(); |
29 } | 29 } |
30 | 30 |
31 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 31 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
32 #ifdef OS_MACOSX | 32 #if defined(OS_MACOSX) |
33 base::FilePath browser_directory; | 33 base::FilePath browser_directory; |
34 PathService::Get(base::DIR_MODULE, &browser_directory); | 34 PathService::Get(base::DIR_MODULE, &browser_directory); |
35 command_line->AppendSwitchPath(switches::kExtraPluginDir, | 35 command_line->AppendSwitchPath(switches::kExtraPluginDir, |
36 browser_directory.AppendASCII("plugins")); | 36 browser_directory.AppendASCII("plugins")); |
37 #endif | 37 #endif |
38 // TODO(jam): since these plugin tests are running under Chrome, we need to | 38 // TODO(jam): since these plugin tests are running under Chrome, we need to |
39 // tell it to disable its security features for old plugins. Once this is | 39 // tell it to disable its security features for old plugins. Once this is |
40 // running under content_browsertests, these flags won't be needed. | 40 // running under content_browsertests, these flags won't be needed. |
41 // http://crbug.com/90448 | 41 // http://crbug.com/90448 |
42 // switches::kAlwaysAuthorizePlugins | 42 // switches::kAlwaysAuthorizePlugins |
43 command_line->AppendSwitch("always-authorize-plugins"); | 43 command_line->AppendSwitch("always-authorize-plugins"); |
44 } | 44 } |
45 }; | 45 }; |
46 | 46 |
47 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { | 47 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { |
48 PluginDataRemoverImpl plugin_data_remover( | 48 PluginDataRemoverImpl plugin_data_remover( |
49 shell()->web_contents()->GetBrowserContext()); | 49 shell()->web_contents()->GetBrowserContext()); |
50 plugin_data_remover.set_mime_type(kNPAPITestPluginMimeType); | 50 plugin_data_remover.set_mime_type(kNPAPITestPluginMimeType); |
51 base::WaitableEventWatcher watcher; | 51 base::WaitableEventWatcher watcher; |
52 base::WaitableEvent* event = | 52 base::WaitableEvent* event = |
53 plugin_data_remover.StartRemoving(base::Time()); | 53 plugin_data_remover.StartRemoving(base::Time()); |
54 watcher.StartWatching( | 54 watcher.StartWatching( |
55 event, | 55 event, |
56 base::Bind(&PluginDataRemoverTest::OnWaitableEventSignaled, this)); | 56 base::Bind(&PluginDataRemoverTest::OnWaitableEventSignaled, this)); |
57 RunMessageLoop(); | 57 RunMessageLoop(); |
58 } | 58 } |
59 | 59 |
60 } // namespace content | 60 } // namespace content |
OLD | NEW |