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

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

Issue 10922002: Remove the translate pyauto test to chrome tests and all the supporting automation hooks. I've adde… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: take out data files so patch applies, will remove separately 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 "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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #include "chrome/browser/protector/protector_utils.h" 82 #include "chrome/browser/protector/protector_utils.h"
83 #include "chrome/browser/search_engines/template_url.h" 83 #include "chrome/browser/search_engines/template_url.h"
84 #include "chrome/browser/search_engines/template_url_service.h" 84 #include "chrome/browser/search_engines/template_url_service.h"
85 #include "chrome/browser/search_engines/template_url_service_factory.h" 85 #include "chrome/browser/search_engines/template_url_service_factory.h"
86 #include "chrome/browser/sessions/session_service_factory.h" 86 #include "chrome/browser/sessions/session_service_factory.h"
87 #include "chrome/browser/sessions/session_tab_helper.h" 87 #include "chrome/browser/sessions/session_tab_helper.h"
88 #include "chrome/browser/sync/profile_sync_service.h" 88 #include "chrome/browser/sync/profile_sync_service.h"
89 #include "chrome/browser/sync/profile_sync_service_factory.h" 89 #include "chrome/browser/sync/profile_sync_service_factory.h"
90 #include "chrome/browser/themes/theme_service.h" 90 #include "chrome/browser/themes/theme_service.h"
91 #include "chrome/browser/themes/theme_service_factory.h" 91 #include "chrome/browser/themes/theme_service_factory.h"
92 #include "chrome/browser/translate/translate_infobar_delegate.h"
93 #include "chrome/browser/translate/translate_tab_helper.h"
94 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 92 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
95 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" 93 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
96 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" 94 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h"
97 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 95 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
98 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 96 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
99 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" 97 #include "chrome/browser/ui/bookmarks/bookmark_bar.h"
100 #include "chrome/browser/ui/browser_commands.h" 98 #include "chrome/browser/ui/browser_commands.h"
101 #include "chrome/browser/ui/browser_finder.h" 99 #include "chrome/browser/ui/browser_finder.h"
102 #include "chrome/browser/ui/browser_instant_controller.h" 100 #include "chrome/browser/ui/browser_instant_controller.h"
103 #include "chrome/browser/ui/browser_list.h" 101 #include "chrome/browser/ui/browser_list.h"
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 &TestingAutomationProvider::GetPluginsInfo; 1869 &TestingAutomationProvider::GetPluginsInfo;
1872 1870
1873 browser_handler_map_["GetNavigationInfo"] = 1871 browser_handler_map_["GetNavigationInfo"] =
1874 &TestingAutomationProvider::GetNavigationInfo; 1872 &TestingAutomationProvider::GetNavigationInfo;
1875 1873
1876 browser_handler_map_["PerformActionOnInfobar"] = 1874 browser_handler_map_["PerformActionOnInfobar"] =
1877 &TestingAutomationProvider::PerformActionOnInfobar; 1875 &TestingAutomationProvider::PerformActionOnInfobar;
1878 1876
1879 browser_handler_map_["GetHistoryInfo"] = 1877 browser_handler_map_["GetHistoryInfo"] =
1880 &TestingAutomationProvider::GetHistoryInfo; 1878 &TestingAutomationProvider::GetHistoryInfo;
1881 browser_handler_map_["AddHistoryItem"] =
1882 &TestingAutomationProvider::AddHistoryItem;
1883 1879
1884 browser_handler_map_["GetOmniboxInfo"] = 1880 browser_handler_map_["GetOmniboxInfo"] =
1885 &TestingAutomationProvider::GetOmniboxInfo; 1881 &TestingAutomationProvider::GetOmniboxInfo;
1886 browser_handler_map_["SetOmniboxText"] = 1882 browser_handler_map_["SetOmniboxText"] =
1887 &TestingAutomationProvider::SetOmniboxText; 1883 &TestingAutomationProvider::SetOmniboxText;
1888 browser_handler_map_["OmniboxAcceptInput"] = 1884 browser_handler_map_["OmniboxAcceptInput"] =
1889 &TestingAutomationProvider::OmniboxAcceptInput; 1885 &TestingAutomationProvider::OmniboxAcceptInput;
1890 browser_handler_map_["OmniboxMovePopupSelection"] = 1886 browser_handler_map_["OmniboxMovePopupSelection"] =
1891 &TestingAutomationProvider::OmniboxMovePopupSelection; 1887 &TestingAutomationProvider::OmniboxMovePopupSelection;
1892 1888
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 &TestingAutomationProvider::UnblockAndLaunchBlockedPopup; 1937 &TestingAutomationProvider::UnblockAndLaunchBlockedPopup;
1942 handler_map_["ResetToDefaultTheme"] = 1938 handler_map_["ResetToDefaultTheme"] =
1943 &TestingAutomationProvider::ResetToDefaultTheme; 1939 &TestingAutomationProvider::ResetToDefaultTheme;
1944 1940
1945 // SetTheme() implemented using InstallExtension(). 1941 // SetTheme() implemented using InstallExtension().
1946 browser_handler_map_["GetThemeInfo"] = 1942 browser_handler_map_["GetThemeInfo"] =
1947 &TestingAutomationProvider::GetThemeInfo; 1943 &TestingAutomationProvider::GetThemeInfo;
1948 1944
1949 browser_handler_map_["FindInPage"] = &TestingAutomationProvider::FindInPage; 1945 browser_handler_map_["FindInPage"] = &TestingAutomationProvider::FindInPage;
1950 1946
1951 browser_handler_map_["SelectTranslateOption"] =
1952 &TestingAutomationProvider::SelectTranslateOption;
1953 browser_handler_map_["GetTranslateInfo"] =
1954 &TestingAutomationProvider::GetTranslateInfo;
1955
1956 browser_handler_map_["GetAllNotifications"] = 1947 browser_handler_map_["GetAllNotifications"] =
1957 &TestingAutomationProvider::GetAllNotifications; 1948 &TestingAutomationProvider::GetAllNotifications;
1958 browser_handler_map_["CloseNotification"] = 1949 browser_handler_map_["CloseNotification"] =
1959 &TestingAutomationProvider::CloseNotification; 1950 &TestingAutomationProvider::CloseNotification;
1960 browser_handler_map_["WaitForNotificationCount"] = 1951 browser_handler_map_["WaitForNotificationCount"] =
1961 &TestingAutomationProvider::WaitForNotificationCount; 1952 &TestingAutomationProvider::WaitForNotificationCount;
1962 1953
1963 browser_handler_map_["SignInToSync"] = 1954 browser_handler_map_["SignInToSync"] =
1964 &TestingAutomationProvider::SignInToSync; 1955 &TestingAutomationProvider::SignInToSync;
1965 browser_handler_map_["GetSyncInfo"] = 1956 browser_handler_map_["GetSyncInfo"] =
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 StringValue* button_label = new StringValue( 2182 StringValue* button_label = new StringValue(
2192 confirm_infobar->GetButtonLabel( 2183 confirm_infobar->GetButtonLabel(
2193 ConfirmInfoBarDelegate::BUTTON_CANCEL)); 2184 ConfirmInfoBarDelegate::BUTTON_CANCEL));
2194 buttons_list->Append(button_label); 2185 buttons_list->Append(button_label);
2195 } 2186 }
2196 infobar_item->Set("buttons", buttons_list); 2187 infobar_item->Set("buttons", buttons_list);
2197 } else if (infobar->AsLinkInfoBarDelegate()) { 2188 } else if (infobar->AsLinkInfoBarDelegate()) {
2198 infobar_item->SetString("type", "link_infobar"); 2189 infobar_item->SetString("type", "link_infobar");
2199 LinkInfoBarDelegate* link_infobar = infobar->AsLinkInfoBarDelegate(); 2190 LinkInfoBarDelegate* link_infobar = infobar->AsLinkInfoBarDelegate();
2200 infobar_item->SetString("link_text", link_infobar->GetLinkText()); 2191 infobar_item->SetString("link_text", link_infobar->GetLinkText());
2201 } else if (infobar->AsTranslateInfoBarDelegate()) {
2202 infobar_item->SetString("type", "translate_infobar");
2203 TranslateInfoBarDelegate* translate_infobar =
2204 infobar->AsTranslateInfoBarDelegate();
2205 infobar_item->SetString("original_lang_code",
2206 translate_infobar->GetOriginalLanguageCode());
2207 infobar_item->SetString("target_lang_code",
2208 translate_infobar->GetTargetLanguageCode());
2209 } else if (infobar->AsExtensionInfoBarDelegate()) { 2192 } else if (infobar->AsExtensionInfoBarDelegate()) {
2210 infobar_item->SetString("type", "extension_infobar"); 2193 infobar_item->SetString("type", "extension_infobar");
2211 } else { 2194 } else {
2212 infobar_item->SetString("type", "unknown_infobar"); 2195 infobar_item->SetString("type", "unknown_infobar");
2213 } 2196 }
2214 infobars->Append(infobar_item); 2197 infobars->Append(infobar_item);
2215 } 2198 }
2216 return infobars; 2199 return infobars;
2217 } 2200 }
2218 2201
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 AutomationProviderHistoryObserver* history_observer = 2611 AutomationProviderHistoryObserver* history_observer =
2629 new AutomationProviderHistoryObserver(this, reply_message); 2612 new AutomationProviderHistoryObserver(this, reply_message);
2630 hs->QueryHistory( 2613 hs->QueryHistory(
2631 search_text, 2614 search_text,
2632 options, 2615 options,
2633 &consumer_, 2616 &consumer_,
2634 base::Bind(&AutomationProviderHistoryObserver::HistoryQueryComplete, 2617 base::Bind(&AutomationProviderHistoryObserver::HistoryQueryComplete,
2635 base::Unretained(history_observer))); 2618 base::Unretained(history_observer)));
2636 } 2619 }
2637 2620
2638 // Sample json input: { "command": "AddHistoryItem",
2639 // "item": { "URL": "http://www.google.com",
2640 // "title": "Google", # optional
2641 // "time": 12345 # optional (time_t)
2642 // } }
2643 // Refer chrome/test/pyautolib/pyauto.py for details on input.
2644 void TestingAutomationProvider::AddHistoryItem(Browser* browser,
2645 DictionaryValue* args,
2646 IPC::Message* reply_message) {
2647 DictionaryValue* item = NULL;
2648 args->GetDictionary("item", &item);
2649 string16 url_text;
2650 string16 title;
2651 base::Time time = base::Time::Now();
2652 AutomationJSONReply reply(this, reply_message);
2653
2654 if (!item->GetString("url", &url_text)) {
2655 reply.SendError("bad args (no URL in dict?)");
2656 return;
2657 }
2658 GURL gurl(url_text);
2659 item->GetString("title", &title); // Don't care if it fails.
2660 int it;
2661 double dt;
2662 if (item->GetInteger("time", &it))
2663 time = base::Time::FromTimeT(it);
2664 else if (item->GetDouble("time", &dt))
2665 time = base::Time::FromDoubleT(dt);
2666
2667 // Ideas for "dummy" values (e.g. id_scope) came from
2668 // chrome/browser/autocomplete/history_contents_provider_unittest.cc
2669 HistoryService* hs = HistoryServiceFactory::GetForProfile(
2670 browser->profile(), Profile::EXPLICIT_ACCESS);
2671 const void* id_scope = reinterpret_cast<void*>(1);
2672 hs->AddPage(gurl, time,
2673 id_scope,
2674 0,
2675 GURL(),
2676 content::PAGE_TRANSITION_LINK,
2677 history::RedirectList(),
2678 history::SOURCE_BROWSED,
2679 false);
2680 if (title.length())
2681 hs->SetPageTitle(gurl, title);
2682 reply.SendSuccess(NULL);
2683 }
2684
2685 // Sample json input: { "command": "GetDownloadsInfo" } 2621 // Sample json input: { "command": "GetDownloadsInfo" }
2686 // Refer chrome/test/pyautolib/download_info.py for sample json output. 2622 // Refer chrome/test/pyautolib/download_info.py for sample json output.
2687 void TestingAutomationProvider::GetDownloadsInfo(Browser* browser, 2623 void TestingAutomationProvider::GetDownloadsInfo(Browser* browser,
2688 DictionaryValue* args, 2624 DictionaryValue* args,
2689 IPC::Message* reply_message) { 2625 IPC::Message* reply_message) {
2690 AutomationJSONReply reply(this, reply_message); 2626 AutomationJSONReply reply(this, reply_message);
2691 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); 2627 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
2692 ListValue* list_of_downloads = new ListValue; 2628 ListValue* list_of_downloads = new ListValue;
2693 2629
2694 DownloadService* download_service( 2630 DownloadService* download_service(
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
3691 } 3627 }
3692 3628
3693 TabContents* tab_contents = chrome::GetTabContentsAt(browser, tab_index); 3629 TabContents* tab_contents = chrome::GetTabContentsAt(browser, tab_index);
3694 if (!tab_contents) { 3630 if (!tab_contents) {
3695 *error_message = StringPrintf("No tab at index %d.", tab_index); 3631 *error_message = StringPrintf("No tab at index %d.", tab_index);
3696 return NULL; 3632 return NULL;
3697 } 3633 }
3698 return tab_contents; 3634 return tab_contents;
3699 } 3635 }
3700 3636
3701 // Get the TranslateInfoBarDelegate from WebContents.
3702 TranslateInfoBarDelegate* GetTranslateInfoBarDelegate(
3703 WebContents* web_contents) {
3704 InfoBarTabHelper* infobar_helper =
3705 TabContents::FromWebContents(web_contents)->infobar_tab_helper();
3706 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); i++) {
3707 InfoBarDelegate* infobar = infobar_helper->GetInfoBarDelegateAt(i);
3708 if (infobar->AsTranslateInfoBarDelegate())
3709 return infobar->AsTranslateInfoBarDelegate();
3710 }
3711 // No translate infobar.
3712 return NULL;
3713 }
3714
3715 } // namespace 3637 } // namespace
3716 3638
3717 void TestingAutomationProvider::FindInPage( 3639 void TestingAutomationProvider::FindInPage(
3718 Browser* browser, 3640 Browser* browser,
3719 DictionaryValue* args, 3641 DictionaryValue* args,
3720 IPC::Message* reply_message) { 3642 IPC::Message* reply_message) {
3721 std::string error_message; 3643 std::string error_message;
3722 TabContents* tab_contents = 3644 TabContents* tab_contents =
3723 GetTabContentsFromDict(browser, args, &error_message); 3645 GetTabContentsFromDict(browser, args, &error_message);
3724 if (!tab_contents) { 3646 if (!tab_contents) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3784 return; 3706 return;
3785 } 3707 }
3786 FindBarTesting* find_bar = 3708 FindBarTesting* find_bar =
3787 browser->GetFindBarController()->find_bar()->GetFindBarTesting(); 3709 browser->GetFindBarController()->find_bar()->GetFindBarTesting();
3788 find_bar->GetFindBarWindowInfo(NULL, &visible); 3710 find_bar->GetFindBarWindowInfo(NULL, &visible);
3789 DictionaryValue dict; 3711 DictionaryValue dict;
3790 dict.SetBoolean("is_visible", visible); 3712 dict.SetBoolean("is_visible", visible);
3791 reply.SendSuccess(&dict); 3713 reply.SendSuccess(&dict);
3792 } 3714 }
3793 3715
3794 // See GetTranslateInfo() in chrome/test/pyautolib/pyauto.py for sample json
3795 // input and output.
3796 void TestingAutomationProvider::GetTranslateInfo(
3797 Browser* browser,
3798 DictionaryValue* args,
3799 IPC::Message* reply_message) {
3800 std::string error_message;
3801 TabContents* tab_contents =
3802 GetTabContentsFromDict(browser, args, &error_message);
3803 if (!tab_contents) {
3804 AutomationJSONReply(this, reply_message).SendError(error_message);
3805 return;
3806 }
3807
3808 WebContents* web_contents = tab_contents->web_contents();
3809 // Get the translate bar if there is one and pass it to the observer.
3810 // The observer will check for null and populate the information accordingly.
3811 TranslateInfoBarDelegate* translate_bar =
3812 GetTranslateInfoBarDelegate(web_contents);
3813
3814 TabLanguageDeterminedObserver* observer = new TabLanguageDeterminedObserver(
3815 this, reply_message, web_contents, translate_bar);
3816 // If the language for the page hasn't been loaded yet, then just make
3817 // the observer, otherwise call observe directly.
3818 TranslateTabHelper* helper =
3819 TabContents::FromWebContents(web_contents)->translate_tab_helper();
3820 std::string language = helper->language_state().original_language();
3821 if (!language.empty()) {
3822 observer->Observe(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED,
3823 content::Source<WebContents>(web_contents),
3824 content::Details<std::string>(&language));
3825 }
3826 }
3827
3828 // See SelectTranslateOption() in chrome/test/pyautolib/pyauto.py for sample
3829 // json input.
3830 // Sample json output: {}
3831 void TestingAutomationProvider::SelectTranslateOption(
3832 Browser* browser,
3833 DictionaryValue* args,
3834 IPC::Message* reply_message) {
3835 std::string option;
3836 std::string error_message;
3837 TabContents* tab_contents =
3838 GetTabContentsFromDict(browser, args, &error_message);
3839 if (!tab_contents) {
3840 AutomationJSONReply(this, reply_message).SendError(error_message);
3841 return;
3842 }
3843
3844 WebContents* web_contents = tab_contents->web_contents();
3845 TranslateInfoBarDelegate* translate_bar =
3846 GetTranslateInfoBarDelegate(web_contents);
3847 if (!translate_bar) {
3848 AutomationJSONReply(this, reply_message)
3849 .SendError("There is no translate bar open.");
3850 return;
3851 }
3852
3853 if (!args->GetString("option", &option)) {
3854 AutomationJSONReply(this, reply_message).SendError("Must include option");
3855 return;
3856 }
3857
3858 if (option == "translate_page") {
3859 // Make a new notification observer which will send the reply.
3860 new PageTranslatedObserver(this, reply_message, web_contents);
3861 translate_bar->Translate();
3862 return;
3863 } else if (option == "set_target_language") {
3864 string16 target_language;
3865 if (!args->GetString("target_language", &target_language)) {
3866 AutomationJSONReply(this, reply_message)
3867 .SendError("Must include target_language string.");
3868 return;
3869 }
3870 // Get the target language index based off of the language name.
3871 size_t target_language_index = TranslateInfoBarDelegate::kNoIndex;
3872 for (size_t i = 0; i < translate_bar->GetLanguageCount(); i++) {
3873 if (translate_bar->GetLanguageDisplayableNameAt(i) == target_language) {
3874 target_language_index = i;
3875 break;
3876 }
3877 }
3878 if (target_language_index == TranslateInfoBarDelegate::kNoIndex) {
3879 AutomationJSONReply(this, reply_message)
3880 .SendError("Invalid target language string.");
3881 return;
3882 }
3883 // If the page has already been translated it will be translated again to
3884 // the new language. The observer will wait until the page has been
3885 // translated to reply.
3886 if (translate_bar->type() == TranslateInfoBarDelegate::AFTER_TRANSLATE) {
3887 new PageTranslatedObserver(this, reply_message, web_contents);
3888 translate_bar->SetTargetLanguage(target_language_index);
3889 return;
3890 }
3891 // Otherwise just send the reply back immediately.
3892 translate_bar->SetTargetLanguage(target_language_index);
3893 scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
3894 return_value->SetBoolean("translation_success", true);
3895 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
3896 return;
3897 } else if (option == "click_always_translate_lang_button") {
3898 if (!translate_bar->ShouldShowAlwaysTranslateButton()) {
3899 AutomationJSONReply(this, reply_message)
3900 .SendError("Always translate button not showing.");
3901 return;
3902 }
3903 // Clicking 'Always Translate' triggers a translation. The observer will
3904 // wait until the translation is complete before sending the reply.
3905 new PageTranslatedObserver(this, reply_message, web_contents);
3906 translate_bar->AlwaysTranslatePageLanguage();
3907 return;
3908 }
3909
3910 AutomationJSONReply reply(this, reply_message);
3911 if (option == "never_translate_language") {
3912 if (translate_bar->IsLanguageBlacklisted()) {
3913 reply.SendError("The language was already blacklisted.");
3914 return;
3915 }
3916 translate_bar->ToggleLanguageBlacklist();
3917 reply.SendSuccess(NULL);
3918 } else if (option == "never_translate_site") {
3919 if (translate_bar->IsSiteBlacklisted()) {
3920 reply.SendError("The site was already blacklisted.");
3921 return;
3922 }
3923 translate_bar->ToggleSiteBlacklist();
3924 reply.SendSuccess(NULL);
3925 } else if (option == "toggle_always_translate") {
3926 translate_bar->ToggleAlwaysTranslate();
3927 reply.SendSuccess(NULL);
3928 } else if (option == "revert_translation") {
3929 translate_bar->RevertTranslation();
3930 reply.SendSuccess(NULL);
3931 } else if (option == "click_never_translate_lang_button") {
3932 if (!translate_bar->ShouldShowNeverTranslateButton()) {
3933 reply.SendError("Always translate button not showing.");
3934 return;
3935 }
3936 translate_bar->NeverTranslatePageLanguage();
3937 reply.SendSuccess(NULL);
3938 } else if (option == "decline_translation") {
3939 // This is the function called when an infobar is dismissed or when the
3940 // user clicks the 'Nope' translate button.
3941 translate_bar->TranslationDeclined();
3942 tab_contents->infobar_tab_helper()->RemoveInfoBar(translate_bar);
3943 reply.SendSuccess(NULL);
3944 } else {
3945 reply.SendError("Invalid string found for option.");
3946 }
3947 }
3948
3949 // Sample json input: { "command": "GetBlockedPopupsInfo", 3716 // Sample json input: { "command": "GetBlockedPopupsInfo",
3950 // "tab_index": 1 } 3717 // "tab_index": 1 }
3951 // Refer GetBlockedPopupsInfo() in pyauto.py for sample output. 3718 // Refer GetBlockedPopupsInfo() in pyauto.py for sample output.
3952 void TestingAutomationProvider::GetBlockedPopupsInfo( 3719 void TestingAutomationProvider::GetBlockedPopupsInfo(
3953 Browser* browser, 3720 Browser* browser,
3954 DictionaryValue* args, 3721 DictionaryValue* args,
3955 IPC::Message* reply_message) { 3722 IPC::Message* reply_message) {
3956 AutomationJSONReply reply(this, reply_message); 3723 AutomationJSONReply reply(this, reply_message);
3957 std::string error_message; 3724 std::string error_message;
3958 TabContents* tab_contents = GetTabContentsFromDict( 3725 TabContents* tab_contents = GetTabContentsFromDict(
(...skipping 2777 matching lines...) Expand 10 before | Expand all | Expand 10 after
6736 void TestingAutomationProvider::OnRemoveProvider() { 6503 void TestingAutomationProvider::OnRemoveProvider() {
6737 if (g_browser_process) 6504 if (g_browser_process)
6738 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 6505 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
6739 } 6506 }
6740 6507
6741 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 6508 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
6742 WebContents* tab) { 6509 WebContents* tab) {
6743 if (chrome::GetActiveWebContents(browser) != tab) 6510 if (chrome::GetActiveWebContents(browser) != tab)
6744 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); 6511 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true);
6745 } 6512 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/browser/translate/translate_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698