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/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/synchronization/waitable_event_watcher.h" | 8 #include "base/synchronization/waitable_event_watcher.h" |
9 #include "content/browser/plugin_data_remover_impl.h" | 9 #include "content/browser/plugin_data_remover_impl.h" |
| 10 #include "content/public/browser/web_contents.h" |
10 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "content/public/test/test_utils.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 13 #include "content/shell/shell.h" |
| 14 #include "content/test/content_browser_test.h" |
13 | 15 |
14 namespace content { | 16 namespace content { |
15 | 17 |
16 namespace { | 18 namespace { |
17 const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test"; | 19 const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test"; |
18 } | 20 } |
19 | 21 |
20 class PluginDataRemoverTest : public InProcessBrowserTest, | 22 class PluginDataRemoverTest : public ContentBrowserTest, |
21 public base::WaitableEventWatcher::Delegate { | 23 public base::WaitableEventWatcher::Delegate { |
22 public: | 24 public: |
23 PluginDataRemoverTest() : InProcessBrowserTest() { } | 25 PluginDataRemoverTest() {} |
24 | 26 |
25 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { | 27 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { |
26 MessageLoop::current()->Quit(); | 28 MessageLoop::current()->Quit(); |
27 } | 29 } |
28 | 30 |
29 virtual void SetUpCommandLine(CommandLine* command_line) { | 31 virtual void SetUpCommandLine(CommandLine* command_line) { |
30 #ifdef OS_MACOSX | 32 #ifdef OS_MACOSX |
31 FilePath browser_directory; | 33 FilePath browser_directory; |
32 PathService::Get(base::DIR_MODULE, &browser_directory); | 34 PathService::Get(base::DIR_MODULE, &browser_directory); |
33 command_line->AppendSwitchPath(switches::kExtraPluginDir, | 35 command_line->AppendSwitchPath(switches::kExtraPluginDir, |
34 browser_directory.AppendASCII("plugins")); | 36 browser_directory.AppendASCII("plugins")); |
35 #endif | 37 #endif |
36 // 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 |
37 // 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 |
38 // running under content_browsertests, these flags won't be needed. | 40 // running under content_browsertests, these flags won't be needed. |
39 // http://crbug.com/90448 | 41 // http://crbug.com/90448 |
40 // switches::kAlwaysAuthorizePlugins | 42 // switches::kAlwaysAuthorizePlugins |
41 command_line->AppendSwitch("always-authorize-plugins"); | 43 command_line->AppendSwitch("always-authorize-plugins"); |
42 } | 44 } |
43 }; | 45 }; |
44 | 46 |
45 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { | 47 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { |
46 PluginDataRemoverImpl plugin_data_remover(GetBrowserContext()); | 48 PluginDataRemoverImpl plugin_data_remover( |
| 49 shell()->web_contents()->GetBrowserContext()); |
47 plugin_data_remover.set_mime_type(kNPAPITestPluginMimeType); | 50 plugin_data_remover.set_mime_type(kNPAPITestPluginMimeType); |
48 base::WaitableEventWatcher watcher; | 51 base::WaitableEventWatcher watcher; |
49 base::WaitableEvent* event = | 52 base::WaitableEvent* event = |
50 plugin_data_remover.StartRemoving(base::Time()); | 53 plugin_data_remover.StartRemoving(base::Time()); |
51 watcher.StartWatching(event, this); | 54 watcher.StartWatching(event, this); |
52 content::RunMessageLoop(); | 55 content::RunMessageLoop(); |
53 } | 56 } |
54 | 57 |
55 } // namespace content | 58 } // namespace content |
OLD | NEW |