OLD | NEW |
---|---|
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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 "frame_doc.getElementById('password_field').value = 'random';" | 370 "frame_doc.getElementById('password_field').value = 'random';" |
371 "frame_doc.getElementById('input_submit_button').click();"; | 371 "frame_doc.getElementById('input_submit_button').click();"; |
372 | 372 |
373 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame)); | 373 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame)); |
374 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); | 374 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
375 observer.Wait(); | 375 observer.Wait(); |
376 EXPECT_TRUE(observer.infobar_shown()); | 376 EXPECT_TRUE(observer.infobar_shown()); |
377 } | 377 } |
378 | 378 |
379 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, | 379 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
380 NoPromptForFailedLoginWithSubFrameNavigation) { | |
381 NavigateToFile("/password/multi_frames.html"); | |
382 | |
383 // Make sure that we don't prompt to save the password for a failed login | |
384 // with a sub-frame navigation happens first. | |
vabr (Chromium)
2014/06/11 08:22:12
nit: with -> when
| |
385 NavigationObserver observer(WebContents()); | |
386 observer.SetPathToWaitFor("/password/failed.html"); | |
387 std::string navigate_frame = | |
388 "var second_iframe = document.getElementById('second_frame');" | |
389 "second_iframe.contentWindow.location.href = 'other.html';"; | |
390 std::string fill_and_submit = | |
391 "var first_frame = document.getElementById('first_frame');" | |
392 "var frame_doc = first_frame.contentDocument;" | |
393 "frame_doc.getElementById('username_failed').value = 'temp';" | |
394 "frame_doc.getElementById('password_failed').value = 'random';" | |
395 "frame_doc.getElementById('submit_failed').click()"; | |
396 | |
397 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame)); | |
398 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); | |
vabr (Chromium)
2014/06/11 08:22:12
Sorry, but I still don't see how this test relates
| |
399 observer.Wait(); | |
400 EXPECT_FALSE(observer.infobar_shown()); | |
401 } | |
402 | |
403 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, | |
380 PromptForXHRSubmit) { | 404 PromptForXHRSubmit) { |
381 #if defined(OS_WIN) && defined(USE_ASH) | 405 #if defined(OS_WIN) && defined(USE_ASH) |
382 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 406 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
383 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 407 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
384 return; | 408 return; |
385 #endif | 409 #endif |
386 NavigateToFile("/password/password_xhr_submit.html"); | 410 NavigateToFile("/password/password_xhr_submit.html"); |
387 | 411 |
388 // Verify that we show the save password prompt if a form returns false | 412 // Verify that we show the save password prompt if a form returns false |
389 // in its onsubmit handler but instead logs in/navigates via XHR. | 413 // in its onsubmit handler but instead logs in/navigates via XHR. |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill)); | 771 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill)); |
748 | 772 |
749 NavigationObserver observer(WebContents()); | 773 NavigationObserver observer(WebContents()); |
750 GURL url = embedded_test_server()->GetURL("/password/password_form.html"); | 774 GURL url = embedded_test_server()->GetURL("/password/password_form.html"); |
751 chrome::NavigateParams params(browser(), url, | 775 chrome::NavigateParams params(browser(), url, |
752 content::PAGE_TRANSITION_RELOAD); | 776 content::PAGE_TRANSITION_RELOAD); |
753 ui_test_utils::NavigateToURL(¶ms); | 777 ui_test_utils::NavigateToURL(¶ms); |
754 observer.Wait(); | 778 observer.Wait(); |
755 EXPECT_FALSE(observer.infobar_shown()); | 779 EXPECT_FALSE(observer.infobar_shown()); |
756 } | 780 } |
OLD | NEW |