summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/automation_provider.cc
diff options
context:
space:
mode:
authornirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-19 21:41:36 +0000
committernirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-19 21:41:36 +0000
commite6e376e2851b35b5ee58935c100452379ce0c1ae (patch)
treed9171a564b5eaf62c0436b21828397b504e68485 /chrome/browser/automation/automation_provider.cc
parentaaeaa620cf80c5d07560c1fc173dc13e38db9aee (diff)
downloadchromium_src-e6e376e2851b35b5ee58935c100452379ce0c1ae.zip
chromium_src-e6e376e2851b35b5ee58935c100452379ce0c1ae.tar.gz
chromium_src-e6e376e2851b35b5ee58935c100452379ce0c1ae.tar.bz2
Add automation hooks for fetching history.
Adding a test which exercises the GetHistoryInfo() hooks. BUG=39275 TEST=python chrome/test/functional/history.py Review URL: http://codereview.chromium.org/1648015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_provider.cc')
-rw-r--r--chrome/browser/automation/automation_provider.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 023b337..dadc49b 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -1571,6 +1571,33 @@ void AutomationProvider::RemoveBookmark(int handle,
*success = false;
}
+// Sample json input: { 'command': 'GetHistoryInfo',
+// 'search_text': 'some text' }
+// Refer chrome/test/pyautolib/history_info.py for sample json output.
+void AutomationProvider::GetHistoryInfo(
+ DictionaryValue* args,
+ IPC::Message* reply_message) {
+ consumer_.CancelAllRequests();
+
+ std::wstring search_text;
+ args->GetString(L"search_text", &search_text);
+
+ // Fetch history.
+ HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
+ history::QueryOptions options;
+ // The observer owns itself. It deletes itself after it fetches history.
+ AutomationProviderHistoryObserver* history_observer =
+ new AutomationProviderHistoryObserver(this, reply_message);
+ hs->QueryHistory(
+ search_text,
+ options,
+ &consumer_,
+ NewCallback(history_observer,
+ &AutomationProviderHistoryObserver::HistoryQueryComplete));
+}
+
+// Sample json input: { 'command': 'GetDownloadsInfo' }
+// Refer chrome/test/pyautolib/download_info.py for sample json output.
void AutomationProvider::GetDownloadsInfo(
DictionaryValue* args,
IPC::Message* reply_message) {
@@ -1720,6 +1747,9 @@ void AutomationProvider::SendJSONRequest(
if (command == "GetDownloadsInfo") {
this->GetDownloadsInfo(dict_value, reply_message);
return;
+ } else if (command == "GetHistoryInfo") {
+ this->GetHistoryInfo(dict_value, reply_message);
+ return;
} else if (command == "WaitForAllDownloadsToComplete") {
this->WaitForDownloadsToComplete(dict_value, reply_message);
return;