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

Side by Side Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 297693002: Tests for "WebView: speed up user gesture notification for GestureTap" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Limit test to Aura Created 6 years, 7 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
« no previous file with comments | « no previous file | chrome/test/data/password/form_and_link.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_samples.h" 8 #include "base/metrics/histogram_samples.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 15 matching lines...) Expand all
26 #include "content/public/browser/render_view_host.h" 26 #include "content/public/browser/render_view_host.h"
27 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
28 #include "content/public/browser/web_contents_observer.h" 28 #include "content/public/browser/web_contents_observer.h"
29 #include "content/public/test/browser_test_utils.h" 29 #include "content/public/test/browser_test_utils.h"
30 #include "content/public/test/test_utils.h" 30 #include "content/public/test/test_utils.h"
31 #include "net/test/embedded_test_server/embedded_test_server.h" 31 #include "net/test/embedded_test_server/embedded_test_server.h"
32 #include "net/url_request/test_url_fetcher_factory.h" 32 #include "net/url_request/test_url_fetcher_factory.h"
33 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
34 #include "third_party/WebKit/public/web/WebInputEvent.h" 34 #include "third_party/WebKit/public/web/WebInputEvent.h"
35 #include "ui/events/keycodes/keyboard_codes.h" 35 #include "ui/events/keycodes/keyboard_codes.h"
36 #include "ui/gfx/geometry/point.h"
36 37
37 38
38 // NavigationObserver --------------------------------------------------------- 39 // NavigationObserver ---------------------------------------------------------
39 40
40 namespace { 41 namespace {
41 42
42 // Observer that waits for navigation to complete and for the password infobar 43 // Observer that waits for navigation to complete and for the password infobar
43 // to be shown. 44 // to be shown.
44 class NavigationObserver : public content::WebContentsObserver, 45 class NavigationObserver : public content::WebContentsObserver,
45 public infobars::InfoBarManager::Observer { 46 public infobars::InfoBarManager::Observer {
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 std::string check_password = 633 std::string check_password =
633 "document.getElementById('password_field').value == 'random'"; 634 "document.getElementById('password_field').value == 'random'";
634 CheckScriptReturnValue(check_username, true); 635 CheckScriptReturnValue(check_username, true);
635 CheckScriptReturnValue(check_password, false); 636 CheckScriptReturnValue(check_password, false);
636 content::SimulateMouseClick( 637 content::SimulateMouseClick(
637 WebContents(), 0, blink::WebMouseEvent::ButtonLeft); 638 WebContents(), 0, blink::WebMouseEvent::ButtonLeft);
638 CheckScriptReturnValue(check_username, true); 639 CheckScriptReturnValue(check_username, true);
639 CheckScriptReturnValue(check_password, true); 640 CheckScriptReturnValue(check_password, true);
640 } 641 }
641 642
643 // The following test is limited to Aura, because
644 // RenderWidgetHostViewGuest::ProcessAckedTouchEvent is, and
645 // ProcessAckedTouchEvent is what triggers the translation of touch events to
646 // gesture events.
647 #if defined(USE_AURA)
648 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
649 PasswordValueAccessibleOnSubmit) {
650 NavigateToFile("/password/form_and_link.html");
651
652 // Fill in the credentials, and make sure they are saved.
653 NavigationObserver form_submit_observer(WebContents());
654 std::string fill_and_submit =
655 "document.getElementById('username_field').value = 'temp';"
656 "document.getElementById('password_field').value = 'random_secret';"
657 "document.getElementById('input_submit_button').click();";
658 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
659 form_submit_observer.Wait();
660 EXPECT_TRUE(form_submit_observer.infobar_shown());
661
662 // Reload the original page to have the saved credentials autofilled.
663 NavigationObserver reload_observer(WebContents());
664 NavigateToFile("/password/form_and_link.html");
665 reload_observer.Wait();
666
667 NavigationObserver submit_observer(WebContents());
668 // Submit the form via a tap on the submit button. The button is placed at 0,
669 // 100, and has height 300 and width 700.
670 content::SimulateTapAt(WebContents(), gfx::Point(350, 250));
671 submit_observer.Wait();
672 std::string query = WebContents()->GetURL().query();
673 EXPECT_NE(std::string::npos, query.find("random_secret")) << query;
674 }
675 #endif
676
642 // Test fix for crbug.com/338650. 677 // Test fix for crbug.com/338650.
643 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, 678 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
644 DontPromptForPasswordFormWithDefaultValue) { 679 DontPromptForPasswordFormWithDefaultValue) {
645 NavigateToFile("/password/password_form_with_default_value.html"); 680 NavigateToFile("/password/password_form_with_default_value.html");
646 681
647 // Don't prompt if we navigate away even if there is a password value since 682 // Don't prompt if we navigate away even if there is a password value since
648 // it's not coming from the user. 683 // it's not coming from the user.
649 NavigationObserver observer(WebContents()); 684 NavigationObserver observer(WebContents());
650 NavigateToFile("/password/done.html"); 685 NavigateToFile("/password/done.html");
651 observer.Wait(); 686 observer.Wait();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill)); 747 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill));
713 748
714 NavigationObserver observer(WebContents()); 749 NavigationObserver observer(WebContents());
715 GURL url = embedded_test_server()->GetURL("/password/password_form.html"); 750 GURL url = embedded_test_server()->GetURL("/password/password_form.html");
716 chrome::NavigateParams params(browser(), url, 751 chrome::NavigateParams params(browser(), url,
717 content::PAGE_TRANSITION_RELOAD); 752 content::PAGE_TRANSITION_RELOAD);
718 ui_test_utils::NavigateToURL(&params); 753 ui_test_utils::NavigateToURL(&params);
719 observer.Wait(); 754 observer.Wait();
720 EXPECT_FALSE(observer.infobar_shown()); 755 EXPECT_FALSE(observer.infobar_shown());
721 } 756 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/password/form_and_link.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698