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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover_browsertest.cc

Issue 10898002: Refactor BrowsingDataRemover creation for clarity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac Created 8 years, 3 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
OLDNEW
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/file_path.h" 5 #include "base/file_path.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "chrome/browser/browsing_data/browsing_data_helper.h" 7 #include "chrome/browser/browsing_data/browsing_data_helper.h"
8 #include "chrome/browser/browsing_data/browsing_data_remover.h" 8 #include "chrome/browser/browsing_data/browsing_data_remover.h"
9 #include "chrome/browser/prefs/pref_service.h" 9 #include "chrome/browser/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 std::string data; 48 std::string data;
49 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( 49 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
50 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", 50 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"",
51 script, &data)); 51 script, &data));
52 ASSERT_EQ(data, result); 52 ASSERT_EQ(data, result);
53 } 53 }
54 54
55 void RemoveAndWait(int remove_mask) { 55 void RemoveAndWait(int remove_mask) {
56 content::WindowedNotificationObserver signal( 56 content::WindowedNotificationObserver signal(
57 chrome::NOTIFICATION_BROWSING_DATA_REMOVED, 57 chrome::NOTIFICATION_BROWSING_DATA_REMOVED,
58 content::Source<Profile>(browser()->profile())); 58 content::Source<Profile>(browser()->profile()));
59 BrowsingDataRemover* remover = new BrowsingDataRemover( 59 BrowsingDataRemover* remover = BrowsingDataRemover::CreateForPeriod(
60 browser()->profile(), BrowsingDataRemover::LAST_HOUR, 60 browser()->profile(), BrowsingDataRemover::LAST_HOUR);
61 base::Time::Now() + base::TimeDelta::FromMilliseconds(10));
62 remover->Remove(remove_mask, BrowsingDataHelper::UNPROTECTED_WEB); 61 remover->Remove(remove_mask, BrowsingDataHelper::UNPROTECTED_WEB);
63 signal.Wait(); 62 signal.Wait();
64 } 63 }
65 }; 64 };
66 65
67 // Test BrowsingDataRemover for downloads. 66 // Test BrowsingDataRemover for downloads.
68 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Download) { 67 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Download) {
69 ScopedTempDir downloads_directory; 68 ScopedTempDir downloads_directory;
70 ASSERT_TRUE(downloads_directory.CreateUniqueTempDir()); 69 ASSERT_TRUE(downloads_directory.CreateUniqueTempDir());
71 browser()->profile()->GetPrefs()->SetFilePath( 70 browser()->profile()->GetPrefs()->SetFilePath(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 RunScriptAndCheckResult(L"insertRecord('text')", "done"); 105 RunScriptAndCheckResult(L"insertRecord('text')", "done");
107 RunScriptAndCheckResult(L"getRecords()", "text"); 106 RunScriptAndCheckResult(L"getRecords()", "text");
108 107
109 RemoveAndWait(BrowsingDataRemover::REMOVE_SITE_DATA); 108 RemoveAndWait(BrowsingDataRemover::REMOVE_SITE_DATA);
110 109
111 ui_test_utils::NavigateToURL(browser(), url); 110 ui_test_utils::NavigateToURL(browser(), url);
112 RunScriptAndCheckResult(L"createTable()", "done"); 111 RunScriptAndCheckResult(L"createTable()", "done");
113 RunScriptAndCheckResult(L"insertRecord('text2')", "done"); 112 RunScriptAndCheckResult(L"insertRecord('text2')", "done");
114 RunScriptAndCheckResult(L"getRecords()", "text2"); 113 RunScriptAndCheckResult(L"getRecords()", "text2");
115 } 114 }
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.cc ('k') | chrome/browser/browsing_data/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698