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

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

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
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"
22 #include "chrome/browser/infobars/infobar_service.h" 21 #include "chrome/browser/infobars/infobar_service.h"
23 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/translate/translate_infobar_delegate.h" 23 #include "chrome/browser/translate/translate_infobar_delegate.h"
25 #include "chrome/browser/translate/translate_manager.h" 24 #include "chrome/browser/translate/translate_manager.h"
26 #include "chrome/browser/ui/browser.h" 25 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_window.h" 26 #include "chrome/browser/ui/browser_window.h"
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model.h"
29 #include "chrome/common/render_messages.h" 28 #include "chrome/common/render_messages.h"
30 #include "chrome/test/base/in_process_browser_test.h" 29 #include "chrome/test/base/in_process_browser_test.h"
31 #include "chrome/test/base/test_switches.h" 30 #include "chrome/test/base/test_switches.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 virtual void OnInsufficientFormData() OVERRIDE { 161 virtual void OnInsufficientFormData() OVERRIDE {
163 OnPersonalDataChanged(); 162 OnPersonalDataChanged();
164 } 163 }
165 164
166 // content::NotificationObserver: 165 // content::NotificationObserver:
167 virtual void Observe(int type, 166 virtual void Observe(int type,
168 const content::NotificationSource& source, 167 const content::NotificationSource& source,
169 const content::NotificationDetails& details) OVERRIDE { 168 const content::NotificationDetails& details) OVERRIDE {
170 infobar_service_ = InfoBarService::FromWebContents( 169 infobar_service_ = InfoBarService::FromWebContents(
171 browser_->tab_strip_model()->GetActiveWebContents()); 170 browser_->tab_strip_model()->GetActiveWebContents());
172 infobar_service_->infobar_at(0)->delegate()->AsConfirmInfoBarDelegate()-> 171 infobar_service_->infobar_at(0)->AsConfirmInfoBarDelegate()->Accept();
173 Accept();
174 } 172 }
175 173
176 void Wait() { 174 void Wait() {
177 if (!alerted_) { 175 if (!alerted_) {
178 has_run_message_loop_ = true; 176 has_run_message_loop_ = true;
179 content::RunMessageLoop(); 177 content::RunMessageLoop();
180 } 178 }
181 PersonalDataManagerFactory::GetForProfile(browser_->profile())-> 179 PersonalDataManagerFactory::GetForProfile(browser_->profile())->
182 RemoveObserver(this); 180 RemoveObserver(this);
183 } 181 }
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 "彼にいくつかの素晴らしいを調達することができます。それから、いくつかの利"); 824 "彼にいくつかの素晴らしいを調達することができます。それから、いくつかの利");
827 825
828 content::WindowedNotificationObserver infobar_observer( 826 content::WindowedNotificationObserver infobar_observer(
829 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 827 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
830 content::NotificationService::AllSources()); 828 content::NotificationService::AllSources());
831 ASSERT_NO_FATAL_FAILURE( 829 ASSERT_NO_FATAL_FAILURE(
832 ui_test_utils::NavigateToURL(browser(), url)); 830 ui_test_utils::NavigateToURL(browser(), url));
833 831
834 // Wait for the translation bar to appear and get it. 832 // Wait for the translation bar to appear and get it.
835 infobar_observer.Wait(); 833 infobar_observer.Wait();
836 TranslateInfoBarDelegate* delegate = 834 TranslateInfoBarDelegate* delegate = InfoBarService::FromWebContents(
837 InfoBarService::FromWebContents(GetWebContents())->infobar_at(0)-> 835 GetWebContents())->infobar_at(0)->AsTranslateInfoBarDelegate();
838 delegate()->AsTranslateInfoBarDelegate();
839 ASSERT_TRUE(delegate); 836 ASSERT_TRUE(delegate);
840 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, 837 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE,
841 delegate->infobar_type()); 838 delegate->infobar_type());
842 839
843 // Simulate translation button press. 840 // Simulate translation button press.
844 delegate->Translate(); 841 delegate->Translate();
845 842
846 content::WindowedNotificationObserver translation_observer( 843 content::WindowedNotificationObserver translation_observer(
847 chrome::NOTIFICATION_PAGE_TRANSLATED, 844 chrome::NOTIFICATION_PAGE_TRANSLATED,
848 content::NotificationService::AllSources()); 845 content::NotificationService::AllSources());
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 ASSERT_TRUE(content::ExecuteScript( 1083 ASSERT_TRUE(content::ExecuteScript(
1087 GetRenderViewHost(), 1084 GetRenderViewHost(),
1088 "document.querySelector('input').autocomplete = 'off';")); 1085 "document.querySelector('input').autocomplete = 'off';"));
1089 1086
1090 // Press the down arrow to select the suggestion and attempt to preview the 1087 // Press the down arrow to select the suggestion and attempt to preview the
1091 // autofilled form. 1088 // autofilled form.
1092 SendKeyToPopupAndWait(ui::VKEY_DOWN); 1089 SendKeyToPopupAndWait(ui::VKEY_DOWN);
1093 } 1090 }
1094 1091
1095 } // namespace autofill 1092 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698