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

Unified Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 10866013: Convert the browsing_data pyauto tests to chrome tests. Remove the ClearBrowsingData automation cod… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix hang on mac Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/testing_automation_provider.cc
===================================================================
--- chrome/browser/automation/testing_automation_provider.cc (revision 152704)
+++ chrome/browser/automation/testing_automation_provider.cc (working copy)
@@ -41,8 +41,6 @@
#include "chrome/browser/bookmarks/bookmark_storage.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
-#include "chrome/browser/browsing_data/browsing_data_helper.h"
-#include "chrome/browser/browsing_data/browsing_data_remover.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/debugger/devtools_window.h"
#include "chrome/browser/download/download_prefs.h"
@@ -1937,9 +1935,6 @@
browser_handler_map_["GetSavedPasswords"] =
&TestingAutomationProvider::GetSavedPasswords;
- browser_handler_map_["ClearBrowsingData"] =
- &TestingAutomationProvider::ClearBrowsingData;
-
browser_handler_map_["GetBlockedPopupsInfo"] =
&TestingAutomationProvider::GetBlockedPopupsInfo;
browser_handler_map_["UnblockAndLaunchBlockedPopup"] =
@@ -3683,67 +3678,6 @@
// Observer deletes itself after sending the result.
}
-// Refer to ClearBrowsingData() in chrome/test/pyautolib/pyauto.py for sample
-// json input.
-// Sample json output: {}
-void TestingAutomationProvider::ClearBrowsingData(
- Browser* browser,
- DictionaryValue* args,
- IPC::Message* reply_message) {
- std::map<std::string, BrowsingDataRemover::TimePeriod> string_to_time_period;
- string_to_time_period["LAST_HOUR"] = BrowsingDataRemover::LAST_HOUR;
- string_to_time_period["LAST_DAY"] = BrowsingDataRemover::LAST_DAY;
- string_to_time_period["LAST_WEEK"] = BrowsingDataRemover::LAST_WEEK;
- string_to_time_period["FOUR_WEEKS"] = BrowsingDataRemover::FOUR_WEEKS;
- string_to_time_period["EVERYTHING"] = BrowsingDataRemover::EVERYTHING;
-
- std::map<std::string, int> string_to_mask_value;
- string_to_mask_value["HISTORY"] = BrowsingDataRemover::REMOVE_HISTORY;
- string_to_mask_value["DOWNLOADS"] = BrowsingDataRemover::REMOVE_DOWNLOADS;
- string_to_mask_value["COOKIES"] = BrowsingDataRemover::REMOVE_SITE_DATA;
- string_to_mask_value["PASSWORDS"] = BrowsingDataRemover::REMOVE_PASSWORDS;
- string_to_mask_value["FORM_DATA"] = BrowsingDataRemover::REMOVE_FORM_DATA;
- string_to_mask_value["CACHE"] = BrowsingDataRemover::REMOVE_CACHE;
-
- std::string time_period;
- ListValue* to_remove;
- if (!args->GetString("time_period", &time_period) ||
- !args->GetList("to_remove", &to_remove)) {
- AutomationJSONReply(this, reply_message)
- .SendError("time_period must be a string and to_remove a list.");
- return;
- }
-
- int remove_mask = 0;
- int num_removals = to_remove->GetSize();
- for (int i = 0; i < num_removals; i++) {
- std::string removal;
- // If the provided string is not part of the map, then error out.
- if (!to_remove->GetString(i, &removal) ||
- !ContainsKey(string_to_mask_value, removal)) {
- AutomationJSONReply(this, reply_message)
- .SendError("Invalid browsing data string found in to_remove.");
- return;
- }
- remove_mask |= string_to_mask_value[removal];
- }
-
- if (!ContainsKey(string_to_time_period, time_period)) {
- AutomationJSONReply(this, reply_message)
- .SendError("Invalid string for time_period.");
- return;
- }
-
- BrowsingDataRemover* remover = new BrowsingDataRemover(
- profile(), string_to_time_period[time_period], base::Time::Now());
-
- remover->AddObserver(
- new AutomationProviderBrowsingDataObserver(this, reply_message));
- remover->Remove(remove_mask, BrowsingDataHelper::UNPROTECTED_WEB);
- // BrowsingDataRemover deletes itself using DeleteHelper.
- // The observer also deletes itself after sending the reply.
-}
-
namespace {
// Get the TabContents from a dictionary of arguments.
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/browser/browsing_data/browsing_data_remover.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698