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

Side by Side Diff: chrome/browser/plugin_data_remover_browsertest.cc

Issue 7664018: Remove string from BrowserProcess interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove test Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_process.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/plugin_data_remover.h"
6 6
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 "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
19 19
20 namespace { 20 namespace {
21 const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test"; 21 const char* kNPAPITestPluginMimeType = "application/vnd.npapi-test";
22 } 22 }
23 23
24 class PluginDataRemoverTest : public InProcessBrowserTest, 24 class PluginDataRemoverTest : public InProcessBrowserTest,
25 public base::WaitableEventWatcher::Delegate { 25 public base::WaitableEventWatcher::Delegate {
26 public: 26 public:
27 PluginDataRemoverTest() : InProcessBrowserTest() { } 27 PluginDataRemoverTest() : InProcessBrowserTest() { }
28 28
29 virtual void SetUpOnMainThread() {
30 old_plugin_data_remover_mime_type_ =
31 g_browser_process->plugin_data_remover_mime_type();
32 g_browser_process->set_plugin_data_remover_mime_type(
33 kNPAPITestPluginMimeType);
34 }
35
36 virtual void TearDownOnMainThread() {
37 g_browser_process->set_plugin_data_remover_mime_type(
38 old_plugin_data_remover_mime_type_);
39 }
40
41 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) { 29 virtual void OnWaitableEventSignaled(base::WaitableEvent* waitable_event) {
42 MessageLoop::current()->Quit(); 30 MessageLoop::current()->Quit();
43 } 31 }
44 32
45 virtual void SetUpCommandLine(CommandLine* command_line) { 33 virtual void SetUpCommandLine(CommandLine* command_line) {
46 #ifdef OS_MACOSX 34 #ifdef OS_MACOSX
47 FilePath browser_directory; 35 FilePath browser_directory;
48 PathService::Get(chrome::DIR_APP, &browser_directory); 36 PathService::Get(chrome::DIR_APP, &browser_directory);
49 command_line->AppendSwitchPath(switches::kExtraPluginDir, 37 command_line->AppendSwitchPath(switches::kExtraPluginDir,
50 browser_directory.AppendASCII("plugins")); 38 browser_directory.AppendASCII("plugins"));
51 #endif 39 #endif
52 } 40 }
53
54 private:
55 std::string old_plugin_data_remover_mime_type_;
56 }; 41 };
57 42
58 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) { 43 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, RemoveData) {
59 scoped_refptr<PluginDataRemover> plugin_data_remover(new PluginDataRemover()); 44 scoped_refptr<PluginDataRemover> plugin_data_remover(new PluginDataRemover());
60 plugin_data_remover->set_mime_type(kNPAPITestPluginMimeType); 45 plugin_data_remover->set_mime_type(kNPAPITestPluginMimeType);
61 base::WaitableEventWatcher watcher; 46 base::WaitableEventWatcher watcher;
62 base::WaitableEvent* event = 47 base::WaitableEvent* event =
63 plugin_data_remover->StartRemoving(base::Time()); 48 plugin_data_remover->StartRemoving(base::Time());
64 watcher.StartWatching(event, this); 49 watcher.StartWatching(event, this);
65 ui_test_utils::RunMessageLoop(); 50 ui_test_utils::RunMessageLoop();
66 } 51 }
67
68 IN_PROC_BROWSER_TEST_F(PluginDataRemoverTest, AtShutdown) {
69 browser()->profile()->GetPrefs()->SetBoolean(
70 prefs::kClearSiteDataOnExit, true);
71 g_browser_process->local_state()->SetBoolean(
72 prefs::kClearPluginLSODataEnabled, true);
73 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_process.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698