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

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 10383174: Convert the CollectedCookies interactive_ui_tests to a browser_test. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 "chrome/browser/automation/testing_automation_provider.h" 5 #include "chrome/browser/automation/testing_automation_provider.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateTab, ActivateTab) 351 IPC_MESSAGE_HANDLER(AutomationMsg_ActivateTab, ActivateTab)
352 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendTab, AppendTab) 352 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendTab, AppendTab)
353 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendBackgroundTab, 353 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_AppendBackgroundTab,
354 AppendBackgroundTab) 354 AppendBackgroundTab)
355 IPC_MESSAGE_HANDLER(AutomationMsg_GetMachPortCount, GetMachPortCount) 355 IPC_MESSAGE_HANDLER(AutomationMsg_GetMachPortCount, GetMachPortCount)
356 IPC_MESSAGE_HANDLER(AutomationMsg_ActiveTabIndex, GetActiveTabIndex) 356 IPC_MESSAGE_HANDLER(AutomationMsg_ActiveTabIndex, GetActiveTabIndex)
357 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseTab, CloseTab) 357 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseTab, CloseTab)
358 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookies, GetCookies) 358 IPC_MESSAGE_HANDLER(AutomationMsg_GetCookies, GetCookies)
359 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookie, SetCookie) 359 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookie, SetCookie)
360 IPC_MESSAGE_HANDLER(AutomationMsg_DeleteCookie, DeleteCookie) 360 IPC_MESSAGE_HANDLER(AutomationMsg_DeleteCookie, DeleteCookie)
361 IPC_MESSAGE_HANDLER(AutomationMsg_ShowCollectedCookiesDialog,
362 ShowCollectedCookiesDialog)
363 IPC_MESSAGE_HANDLER_DELAY_REPLY( 361 IPC_MESSAGE_HANDLER_DELAY_REPLY(
364 AutomationMsg_NavigateToURLBlockUntilNavigationsComplete, 362 AutomationMsg_NavigateToURLBlockUntilNavigationsComplete,
365 NavigateToURLBlockUntilNavigationsComplete) 363 NavigateToURLBlockUntilNavigationsComplete)
366 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsync, NavigationAsync) 364 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsync, NavigationAsync)
367 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsyncWithDisposition, 365 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationAsyncWithDisposition,
368 NavigationAsyncWithDisposition) 366 NavigationAsyncWithDisposition)
369 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_Reload, Reload) 367 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_Reload, Reload)
370 IPC_MESSAGE_HANDLER(AutomationMsg_BrowserWindowCount, GetBrowserWindowCount) 368 IPC_MESSAGE_HANDLER(AutomationMsg_BrowserWindowCount, GetBrowserWindowCount)
371 IPC_MESSAGE_HANDLER(AutomationMsg_NormalBrowserWindowCount, 369 IPC_MESSAGE_HANDLER(AutomationMsg_NormalBrowserWindowCount,
372 GetNormalBrowserWindowCount) 370 GetNormalBrowserWindowCount)
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 } 672 }
675 673
676 void TestingAutomationProvider::DeleteCookie(const GURL& url, 674 void TestingAutomationProvider::DeleteCookie(const GURL& url,
677 const std::string& cookie_name, 675 const std::string& cookie_name,
678 int handle, bool* success) { 676 int handle, bool* success) {
679 WebContents* contents = tab_tracker_->ContainsHandle(handle) ? 677 WebContents* contents = tab_tracker_->ContainsHandle(handle) ?
680 tab_tracker_->GetResource(handle)->GetWebContents() : NULL; 678 tab_tracker_->GetResource(handle)->GetWebContents() : NULL;
681 automation_util::DeleteCookie(url, cookie_name, contents, success); 679 automation_util::DeleteCookie(url, cookie_name, contents, success);
682 } 680 }
683 681
684 void TestingAutomationProvider::ShowCollectedCookiesDialog(
685 int handle, bool* success) {
686 *success = false;
687 if (tab_tracker_->ContainsHandle(handle)) {
688 NavigationController* controller = tab_tracker_->GetResource(handle);
689 WebContents* tab_contents = controller->GetWebContents();
690 Browser* browser = Browser::GetBrowserForController(controller, NULL);
691 browser->ShowCollectedCookiesDialog(
692 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents));
693 *success = true;
694 }
695 }
696
697 void TestingAutomationProvider::NavigateToURLBlockUntilNavigationsComplete( 682 void TestingAutomationProvider::NavigateToURLBlockUntilNavigationsComplete(
698 int handle, const GURL& url, int number_of_navigations, 683 int handle, const GURL& url, int number_of_navigations,
699 IPC::Message* reply_message) { 684 IPC::Message* reply_message) {
700 if (tab_tracker_->ContainsHandle(handle)) { 685 if (tab_tracker_->ContainsHandle(handle)) {
701 NavigationController* tab = tab_tracker_->GetResource(handle); 686 NavigationController* tab = tab_tracker_->GetResource(handle);
702 687
703 // Simulate what a user would do. Activate the tab and then navigate. 688 // Simulate what a user would do. Activate the tab and then navigate.
704 // We could allow navigating in a background tab in future. 689 // We could allow navigating in a background tab in future.
705 Browser* browser = FindAndActivateTab(tab); 690 Browser* browser = FindAndActivateTab(tab);
706 691
(...skipping 6433 matching lines...) Expand 10 before | Expand all | Expand 10 after
7140 *browser_handle = browser_tracker_->Add(browser); 7125 *browser_handle = browser_tracker_->Add(browser);
7141 *success = true; 7126 *success = true;
7142 } 7127 }
7143 } 7128 }
7144 } 7129 }
7145 7130
7146 void TestingAutomationProvider::OnRemoveProvider() { 7131 void TestingAutomationProvider::OnRemoveProvider() {
7147 if (g_browser_process) 7132 if (g_browser_process)
7148 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 7133 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
7149 } 7134 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/browser/collected_cookies_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698