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

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, 2 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) 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 content::WindowedNotificationObserver infobar_observer( 865 content::WindowedNotificationObserver infobar_observer(
864 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 866 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
865 content::NotificationService::AllSources()); 867 content::NotificationService::AllSources());
866 ASSERT_NO_FATAL_FAILURE( 868 ASSERT_NO_FATAL_FAILURE(
867 ui_test_utils::NavigateToURL(browser(), url)); 869 ui_test_utils::NavigateToURL(browser(), url));
868 870
869 // Wait for the translation bar to appear and get it. 871 // Wait for the translation bar to appear and get it.
870 infobar_observer.Wait(); 872 infobar_observer.Wait();
871 TranslateInfoBarDelegate* delegate = InfoBarService::FromWebContents( 873 TranslateInfoBarDelegate* delegate = InfoBarService::FromWebContents(
872 browser()->tab_strip_model()->GetActiveWebContents())->infobar_at(0)-> 874 browser()->tab_strip_model()->GetActiveWebContents())->infobar_at(0)->
873 AsTranslateInfoBarDelegate(); 875 delegate()->AsTranslateInfoBarDelegate();
874 ASSERT_TRUE(delegate); 876 ASSERT_TRUE(delegate);
875 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, 877 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE,
876 delegate->infobar_type()); 878 delegate->infobar_type());
877 879
878 // Simulate translation button press. 880 // Simulate translation button press.
879 delegate->Translate(); 881 delegate->Translate();
880 882
881 content::WindowedNotificationObserver translation_observer( 883 content::WindowedNotificationObserver translation_observer(
882 chrome::NOTIFICATION_PAGE_TRANSLATED, 884 chrome::NOTIFICATION_PAGE_TRANSLATED,
883 content::NotificationService::AllSources()); 885 content::NotificationService::AllSources());
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 GetRenderViewHost(), 1139 GetRenderViewHost(),
1138 "var city = document.getElementById('city');" 1140 "var city = document.getElementById('city');"
1139 "city.onfocus = function() { domAutomationController.send(true); };" 1141 "city.onfocus = function() { domAutomationController.send(true); };"
1140 "city.focus()", 1142 "city.focus()",
1141 &result)); 1143 &result));
1142 ASSERT_TRUE(result); 1144 ASSERT_TRUE(result);
1143 SendKeyToPageAndWait(ui::VKEY_A); 1145 SendKeyToPageAndWait(ui::VKEY_A);
1144 } 1146 }
1145 1147
1146 } // namespace autofill 1148 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698