OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
13 | 13 |
| 14 namespace content { |
| 15 |
14 namespace { | 16 namespace { |
15 const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test"; | 17 const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test"; |
16 } | 18 } |
17 | 19 |
18 class PluginDataRemoverTest : public InProcessBrowserTest, | 20 class PluginDataRemoverTest : public InProcessBrowserTest, |
19 public base::WaitableEventWatcher::Delegate { | 21 public base::WaitableEventWatcher::Delegate { |
20 public: | 22 public: |
21 PluginDataRemoverTest() : InProcessBrowserTest() { } | 23 PluginDataRemoverTest() : InProcessBrowserTest() { } |
22 | 24 |
23 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { | 25 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { |
24 MessageLoop::current()->Quit(); | 26 MessageLoop::current()->Quit(); |
25 } | 27 } |
26 | 28 |
27 virtual void SetUpCommandLine(CommandLine* command_line) { | 29 virtual void SetUpCommandLine(CommandLine* command_line) { |
28 #ifdef OS_MACOSX | 30 #ifdef OS_MACOSX |
29 FilePath browser_directory; | 31 FilePath browser_directory; |
30 PathService::Get(base::DIR_MODULE, &browser_directory); | 32 PathService::Get(base::DIR_MODULE, &browser_directory); |
31 command_line->AppendSwitchPath(switches::kExtraPluginDir, | 33 command_line->AppendSwitchPath(switches::kExtraPluginDir, |
32 browser_directory.AppendASCII("plugins")); | 34 browser_directory.AppendASCII("plugins")); |
33 #endif | 35 #endif |
34 } | 36 } |
35 }; | 37 }; |
36 | 38 |
37 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { | 39 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { |
38 PluginDataRemoverImpl plugin_data_remover(GetResourceContext()); | 40 PluginDataRemoverImpl plugin_data_remover(GetBrowserContext()); |
39 plugin_data_remover.set_mime_type(kNPAPITestPluginMimeType); | 41 plugin_data_remover.set_mime_type(kNPAPITestPluginMimeType); |
40 base::WaitableEventWatcher watcher; | 42 base::WaitableEventWatcher watcher; |
41 base::WaitableEvent* event = | 43 base::WaitableEvent* event = |
42 plugin_data_remover.StartRemoving(base::Time()); | 44 plugin_data_remover.StartRemoving(base::Time()); |
43 watcher.StartWatching(event, this); | 45 watcher.StartWatching(event, this); |
44 ui_test_utils::RunMessageLoop(); | 46 ui_test_utils::RunMessageLoop(); |
45 } | 47 } |
| 48 |
| 49 } // namespace content |
OLD | NEW |