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 "chrome/browser/plugin_data_remover.h" | 5 #include "base/base_paths.h" |
6 | |
7 #include "base/command_line.h" | 6 #include "base/command_line.h" |
8 #include "base/path_service.h" | 7 #include "base/path_service.h" |
9 #include "base/synchronization/waitable_event_watcher.h" | 8 #include "base/synchronization/waitable_event_watcher.h" |
10 #include "chrome/browser/ui/browser.h" | 9 #include "content/browser/plugin_data_remover_impl.h" |
11 #include "chrome/browser/browser_process.h" | 10 #include "content/public/common/content_switches.h" |
12 #include "chrome/browser/prefs/pref_service.h" | |
13 #include "chrome/browser/profiles/profile.h" | |
14 #include "chrome/common/chrome_paths.h" | |
15 #include "chrome/common/chrome_switches.h" | |
16 #include "chrome/common/pref_names.h" | |
17 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
19 | 13 |
20 namespace { | 14 namespace { |
21 const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test"; | 15 const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test"; |
22 } | 16 } |
23 | 17 |
24 class PluginDataRemoverTest : public InProcessBrowserTest, | 18 class PluginDataRemoverTest : public InProcessBrowserTest, |
25 public base::WaitableEventWatcher::Delegate { | 19 public base::WaitableEventWatcher::Delegate { |
26 public: | 20 public: |
27 PluginDataRemoverTest() : InProcessBrowserTest() { } | 21 PluginDataRemoverTest() : InProcessBrowserTest() { } |
28 | 22 |
29 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { | 23 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { |
30 MessageLoop::current()->Quit(); | 24 MessageLoop::current()->Quit(); |
31 } | 25 } |
32 | 26 |
33 virtual void SetUpCommandLine(CommandLine* command_line) { | 27 virtual void SetUpCommandLine(CommandLine* command_line) { |
34 #ifdef OS_MACOSX | 28 #ifdef OS_MACOSX |
35 FilePath browser_directory; | 29 FilePath browser_directory; |
36 PathService::Get(chrome::DIR_APP, &browser_directory); | 30 PathService::Get(base::DIR_MODULE, &browser_directory); |
37 command_line->AppendSwitchPath(switches::kExtraPluginDir, | 31 command_line->AppendSwitchPath(switches::kExtraPluginDir, |
38 browser_directory.AppendASCII("plugins")); | 32 browser_directory.AppendASCII("plugins")); |
39 #endif | 33 #endif |
40 } | 34 } |
41 }; | 35 }; |
42 | 36 |
43 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { | 37 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { |
44 scoped_refptr<PluginDataRemover> plugin_data_remover( | 38 PluginDataRemoverImpl plugin_data_remover(GetResourceContext()); |
45 new PluginDataRemover(browser()->profile())); | 39 plugin_data_remover.set_mime_type(kNPAPITestPluginMimeType); |
46 plugin_data_remover->set_mime_type(kNPAPITestPluginMimeType); | |
47 base::WaitableEventWatcher watcher; | 40 base::WaitableEventWatcher watcher; |
48 base::WaitableEvent* event = | 41 base::WaitableEvent* event = |
49 plugin_data_remover->StartRemoving(base::Time()); | 42 plugin_data_remover.StartRemoving(base::Time()); |
50 watcher.StartWatching(event, this); | 43 watcher.StartWatching(event, this); |
51 ui_test_utils::RunMessageLoop(); | 44 ui_test_utils::RunMessageLoop(); |
52 } | 45 } |
OLD | NEW |