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

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

Issue 10033001: Convert printing ui_tests to browser_tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 8 years, 8 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "chrome/browser/notifications/balloon_collection.h" 66 #include "chrome/browser/notifications/balloon_collection.h"
67 #include "chrome/browser/notifications/notification.h" 67 #include "chrome/browser/notifications/notification.h"
68 #include "chrome/browser/notifications/notification_ui_manager.h" 68 #include "chrome/browser/notifications/notification_ui_manager.h"
69 #include "chrome/browser/password_manager/password_store.h" 69 #include "chrome/browser/password_manager/password_store.h"
70 #include "chrome/browser/password_manager/password_store_change.h" 70 #include "chrome/browser/password_manager/password_store_change.h"
71 #include "chrome/browser/password_manager/password_store_factory.h" 71 #include "chrome/browser/password_manager/password_store_factory.h"
72 #include "chrome/browser/platform_util.h" 72 #include "chrome/browser/platform_util.h"
73 #include "chrome/browser/plugin_prefs.h" 73 #include "chrome/browser/plugin_prefs.h"
74 #include "chrome/browser/prefs/pref_service.h" 74 #include "chrome/browser/prefs/pref_service.h"
75 #include "chrome/browser/printing/print_preview_tab_controller.h" 75 #include "chrome/browser/printing/print_preview_tab_controller.h"
76 #include "chrome/browser/printing/print_view_manager.h"
77 #include "chrome/browser/profiles/profile.h" 76 #include "chrome/browser/profiles/profile.h"
78 #include "chrome/browser/profiles/profile_info_cache.h" 77 #include "chrome/browser/profiles/profile_info_cache.h"
79 #include "chrome/browser/profiles/profile_manager.h" 78 #include "chrome/browser/profiles/profile_manager.h"
80 #include "chrome/browser/protector/protector_service.h" 79 #include "chrome/browser/protector/protector_service.h"
81 #include "chrome/browser/protector/protector_service_factory.h" 80 #include "chrome/browser/protector/protector_service_factory.h"
82 #include "chrome/browser/protector/protector_utils.h" 81 #include "chrome/browser/protector/protector_utils.h"
83 #include "chrome/browser/search_engines/template_url.h" 82 #include "chrome/browser/search_engines/template_url.h"
84 #include "chrome/browser/search_engines/template_url_service.h" 83 #include "chrome/browser/search_engines/template_url_service.h"
85 #include "chrome/browser/search_engines/template_url_service_factory.h" 84 #include "chrome/browser/search_engines/template_url_service_factory.h"
86 #include "chrome/browser/sessions/restore_tab_helper.h" 85 #include "chrome/browser/sessions/restore_tab_helper.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 WaitForTabToBeRestored) 419 WaitForTabToBeRestored)
421 IPC_MESSAGE_HANDLER(AutomationMsg_GetSecurityState, GetSecurityState) 420 IPC_MESSAGE_HANDLER(AutomationMsg_GetSecurityState, GetSecurityState)
422 IPC_MESSAGE_HANDLER(AutomationMsg_GetPageType, GetPageType) 421 IPC_MESSAGE_HANDLER(AutomationMsg_GetPageType, GetPageType)
423 IPC_MESSAGE_HANDLER(AutomationMsg_GetMetricEventDuration, 422 IPC_MESSAGE_HANDLER(AutomationMsg_GetMetricEventDuration,
424 GetMetricEventDuration) 423 GetMetricEventDuration)
425 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_ActionOnSSLBlockingPage, 424 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_ActionOnSSLBlockingPage,
426 ActionOnSSLBlockingPage) 425 ActionOnSSLBlockingPage)
427 IPC_MESSAGE_HANDLER(AutomationMsg_BringBrowserToFront, BringBrowserToFront) 426 IPC_MESSAGE_HANDLER(AutomationMsg_BringBrowserToFront, BringBrowserToFront)
428 IPC_MESSAGE_HANDLER(AutomationMsg_IsMenuCommandEnabled, 427 IPC_MESSAGE_HANDLER(AutomationMsg_IsMenuCommandEnabled,
429 IsMenuCommandEnabled) 428 IsMenuCommandEnabled)
430 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_PrintNow, PrintNow)
431 IPC_MESSAGE_HANDLER(AutomationMsg_SavePage, SavePage) 429 IPC_MESSAGE_HANDLER(AutomationMsg_SavePage, SavePage)
432 IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPage, 430 IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPage,
433 HandleOpenFindInPageRequest) 431 HandleOpenFindInPageRequest)
434 IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowVisibility, 432 IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowVisibility,
435 GetFindWindowVisibility) 433 GetFindWindowVisibility)
436 IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowLocation, 434 IPC_MESSAGE_HANDLER(AutomationMsg_FindWindowLocation,
437 HandleFindWindowLocationRequest) 435 HandleFindWindowLocationRequest)
438 IPC_MESSAGE_HANDLER(AutomationMsg_BookmarkBarVisibility, 436 IPC_MESSAGE_HANDLER(AutomationMsg_BookmarkBarVisibility,
439 GetBookmarkBarVisibility) 437 GetBookmarkBarVisibility)
440 IPC_MESSAGE_HANDLER(AutomationMsg_GetBookmarksAsJSON, 438 IPC_MESSAGE_HANDLER(AutomationMsg_GetBookmarksAsJSON,
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 int message_num, 1681 int message_num,
1684 bool* menu_item_enabled) { 1682 bool* menu_item_enabled) {
1685 *menu_item_enabled = false; 1683 *menu_item_enabled = false;
1686 if (browser_tracker_->ContainsHandle(browser_handle)) { 1684 if (browser_tracker_->ContainsHandle(browser_handle)) {
1687 Browser* browser = browser_tracker_->GetResource(browser_handle); 1685 Browser* browser = browser_tracker_->GetResource(browser_handle);
1688 *menu_item_enabled = 1686 *menu_item_enabled =
1689 browser->command_updater()->IsCommandEnabled(message_num); 1687 browser->command_updater()->IsCommandEnabled(message_num);
1690 } 1688 }
1691 } 1689 }
1692 1690
1693 void TestingAutomationProvider::PrintNow(int tab_handle,
1694 IPC::Message* reply_message) {
1695 NavigationController* tab = NULL;
1696 WebContents* web_contents = GetWebContentsForHandle(tab_handle, &tab);
1697 if (web_contents) {
1698 FindAndActivateTab(tab);
1699
1700 content::NotificationObserver* observer =
1701 new DocumentPrintedNotificationObserver(this, reply_message);
1702
1703 TabContentsWrapper* wrapper =
1704 TabContentsWrapper::GetCurrentWrapperForContents(web_contents);
1705 if (!wrapper->print_view_manager()->PrintNow()) {
1706 // Clean up the observer. It will send the reply message.
1707 delete observer;
1708 }
1709
1710 // Return now to avoid sending reply message twice.
1711 return;
1712 }
1713
1714 AutomationMsg_PrintNow::WriteReplyParams(reply_message, false);
1715 Send(reply_message);
1716 }
1717
1718 void TestingAutomationProvider::SavePage(int tab_handle, 1691 void TestingAutomationProvider::SavePage(int tab_handle,
1719 const FilePath& file_name, 1692 const FilePath& file_name,
1720 const FilePath& dir_path, 1693 const FilePath& dir_path,
1721 int type, 1694 int type,
1722 bool* success) { 1695 bool* success) {
1723 content::SavePageType save_type = 1696 content::SavePageType save_type =
1724 static_cast<content::SavePageType>(type); 1697 static_cast<content::SavePageType>(type);
1725 if (save_type < content::SAVE_PAGE_TYPE_AS_ONLY_HTML || 1698 if (save_type < content::SAVE_PAGE_TYPE_AS_ONLY_HTML ||
1726 save_type > content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML) { 1699 save_type > content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML) {
1727 *success = false; 1700 *success = false;
(...skipping 5371 matching lines...) Expand 10 before | Expand all | Expand 10 after
7099 *browser_handle = browser_tracker_->Add(browser); 7072 *browser_handle = browser_tracker_->Add(browser);
7100 *success = true; 7073 *success = true;
7101 } 7074 }
7102 } 7075 }
7103 } 7076 }
7104 7077
7105 void TestingAutomationProvider::OnRemoveProvider() { 7078 void TestingAutomationProvider::OnRemoveProvider() {
7106 if (g_browser_process) 7079 if (g_browser_process)
7107 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 7080 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
7108 } 7081 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/browser/printing/printing_layout_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698