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

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

Issue 10807047: Create content\public\test\test_utils.h to hold common test classes that are used by unit and brows… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ExpectFieldValue(L"address1", "4120 Freidrich Lane"); 203 ExpectFieldValue(L"address1", "4120 Freidrich Lane");
204 ExpectFieldValue(L"address2", "Basement"); 204 ExpectFieldValue(L"address2", "Basement");
205 ExpectFieldValue(L"city", "Austin"); 205 ExpectFieldValue(L"city", "Austin");
206 ExpectFieldValue(L"state", "TX"); 206 ExpectFieldValue(L"state", "TX");
207 ExpectFieldValue(L"zip", "78744"); 207 ExpectFieldValue(L"zip", "78744");
208 ExpectFieldValue(L"country", "US"); 208 ExpectFieldValue(L"country", "US");
209 ExpectFieldValue(L"phone", "5125551234"); 209 ExpectFieldValue(L"phone", "5125551234");
210 } 210 }
211 211
212 void SendKeyAndWait(ui::KeyboardCode key, int notification_type) { 212 void SendKeyAndWait(ui::KeyboardCode key, int notification_type) {
213 ui_test_utils::WindowedNotificationObserver observer( 213 content::WindowedNotificationObserver observer(
214 notification_type, content::Source<RenderViewHost>(render_view_host())); 214 notification_type, content::Source<RenderViewHost>(render_view_host()));
215 ui_test_utils::SimulateKeyPress(chrome::GetActiveWebContents( 215 ui_test_utils::SimulateKeyPress(chrome::GetActiveWebContents(
216 browser()), key, false, false, false, false); 216 browser()), key, false, false, false, false);
217 observer.Wait(); 217 observer.Wait();
218 } 218 }
219 219
220 void TryBasicFormFill() { 220 void TryBasicFormFill() {
221 FocusFirstNameField(); 221 FocusFirstNameField();
222 222
223 // Start filling the first name field with "M" and wait for the popup to be 223 // Start filling the first name field with "M" and wait for the popup to be
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 ASSERT_TRUE(infobar != NULL); 684 ASSERT_TRUE(infobar != NULL);
685 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type()); 685 EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, infobar->type());
686 686
687 // Simulate translation button press. 687 // Simulate translation button press.
688 infobar->Translate(); 688 infobar->Translate();
689 689
690 // Simulate the translate script being retrieved. 690 // Simulate the translate script being retrieved.
691 // Pass fake google.translate lib as the translate script. 691 // Pass fake google.translate lib as the translate script.
692 SimulateURLFetch(true); 692 SimulateURLFetch(true);
693 693
694 ui_test_utils::WindowedNotificationObserver translation_observer( 694 content::WindowedNotificationObserver translation_observer(
695 chrome::NOTIFICATION_PAGE_TRANSLATED, 695 chrome::NOTIFICATION_PAGE_TRANSLATED,
696 content::NotificationService::AllSources()); 696 content::NotificationService::AllSources());
697 697
698 // Simulate translation to kick onTranslateElementLoad. 698 // Simulate translation to kick onTranslateElementLoad.
699 // But right now, the call stucks here. 699 // But right now, the call stucks here.
700 // Once click the text field, it starts again. 700 // Once click the text field, it starts again.
701 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( 701 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript(
702 render_view_host(), L"", 702 render_view_host(), L"",
703 L"cr.googleTranslate.onTranslateElementLoad();")); 703 L"cr.googleTranslate.onTranslateElementLoad();"));
704 704
705 // Simulate the render notifying the translation has been done. 705 // Simulate the render notifying the translation has been done.
706 translation_observer.Wait(); 706 translation_observer.Wait();
707 707
708 TryBasicFormFill(); 708 TryBasicFormFill();
709 } 709 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_browsertest.cc ('k') | chrome/browser/autofill/autofill_popup_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698