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

Side by Side Diff: chrome/browser/autofill/autofill_interactive_uitest.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/autofill/personal_data_manager_factory.h" 18 #include "chrome/browser/autofill/personal_data_manager_factory.h"
19 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 20 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
21 #include "chrome/browser/infobars/infobar.h"
21 #include "chrome/browser/infobars/infobar_service.h" 22 #include "chrome/browser/infobars/infobar_service.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/translate/translate_infobar_delegate.h" 24 #include "chrome/browser/translate/translate_infobar_delegate.h"
24 #include "chrome/browser/translate/translate_manager.h" 25 #include "chrome/browser/translate/translate_manager.h"
25 #include "chrome/browser/ui/browser.h" 26 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_window.h" 27 #include "chrome/browser/ui/browser_window.h"
27 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
28 #include "chrome/common/render_messages.h" 29 #include "chrome/common/render_messages.h"
29 #include "chrome/test/base/in_process_browser_test.h" 30 #include "chrome/test/base/in_process_browser_test.h"
30 #include "chrome/test/base/test_switches.h" 31 #include "chrome/test/base/test_switches.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 virtual void OnInsufficientFormData() OVERRIDE { 162 virtual void OnInsufficientFormData() OVERRIDE {
162 OnPersonalDataChanged(); 163 OnPersonalDataChanged();
163 } 164 }
164 165
165 // content::NotificationObserver: 166 // content::NotificationObserver:
166 virtual void Observe(int type, 167 virtual void Observe(int type,
167 const content::NotificationSource& source, 168 const content::NotificationSource& source,
168 const content::NotificationDetails& details) OVERRIDE { 169 const content::NotificationDetails& details) OVERRIDE {
169 infobar_service_ = InfoBarService::FromWebContents( 170 infobar_service_ = InfoBarService::FromWebContents(
170 browser_->tab_strip_model()->GetActiveWebContents()); 171 browser_->tab_strip_model()->GetActiveWebContents());
171 infobar_service_->infobar_at(0)->AsConfirmInfoBarDelegate()->Accept(); 172 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate()->
173 Accept();
172 } 174 }
173 175
174 void Wait() { 176 void Wait() {
175 if (!alerted_) { 177 if (!alerted_) {
176 has_run_message_loop_ = true; 178 has_run_message_loop_ = true;
177 content::RunMessageLoop(); 179 content::RunMessageLoop();
178 } 180 }
179 PersonalDataManagerFactory::GetForProfile(browser_->profile())-> 181 PersonalDataManagerFactory::GetForProfile(browser_->profile())->
180 RemoveObserver(this); 182 RemoveObserver(this);
181 } 183 }
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 "彼にいくつかの素晴らしいを調達することができます。それから、いくつかの利"); 826 "彼にいくつかの素晴らしいを調達することができます。それから、いくつかの利");
825 827
826 content::WindowedNotificationObserver infobar_observer( 828 content::WindowedNotificationObserver infobar_observer(
827 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 829 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
828 content::NotificationService::AllSources()); 830 content::NotificationService::AllSources());
829 ASSERT_NO_FATAL_FAILURE( 831 ASSERT_NO_FATAL_FAILURE(
830 ui_test_utils::NavigateToURL(browser(), url)); 832 ui_test_utils::NavigateToURL(browser(), url));
831 833
832 // Wait for the translation bar to appear and get it. 834 // Wait for the translation bar to appear and get it.
833 infobar_observer.Wait(); 835 infobar_observer.Wait();
834 TranslateInfoBarDelegate* delegate = InfoBarService::FromWebContents( 836 TranslateInfoBarDelegate* delegate =
835 GetWebContents())->infobar_at(0)->AsTranslateInfoBarDelegate(); 837 InfoBarService::FromWebContents(GetWebContents())->infobar_at(0)->
838 delegate()->AsTranslateInfoBarDelegate();
836 ASSERT_TRUE(delegate); 839 ASSERT_TRUE(delegate);
837 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, 840 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE,
838 delegate->infobar_type()); 841 delegate->infobar_type());
839 842
840 // Simulate translation button press. 843 // Simulate translation button press.
841 delegate->Translate(); 844 delegate->Translate();
842 845
843 content::WindowedNotificationObserver translation_observer( 846 content::WindowedNotificationObserver translation_observer(
844 chrome::NOTIFICATION_PAGE_TRANSLATED, 847 chrome::NOTIFICATION_PAGE_TRANSLATED,
845 content::NotificationService::AllSources()); 848 content::NotificationService::AllSources());
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 ASSERT_TRUE(content::ExecuteScript( 1086 ASSERT_TRUE(content::ExecuteScript(
1084 GetRenderViewHost(), 1087 GetRenderViewHost(),
1085 "document.querySelector('input').autocomplete = 'off';")); 1088 "document.querySelector('input').autocomplete = 'off';"));
1086 1089
1087 // Press the down arrow to select the suggestion and attempt to preview the 1090 // Press the down arrow to select the suggestion and attempt to preview the
1088 // autofilled form. 1091 // autofilled form.
1089 SendKeyToPopupAndWait(ui::VKEY_DOWN); 1092 SendKeyToPopupAndWait(ui::VKEY_DOWN);
1090 } 1093 }
1091 1094
1092 } // namespace autofill 1095 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_cc_infobar_delegate.cc ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698