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 "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
886 std::string fill_and_submit = | 886 std::string fill_and_submit = |
887 "document.getElementsByName('username_field_no_id')[0].value = 'temp';" | 887 "document.getElementsByName('username_field_no_id')[0].value = 'temp';" |
888 "document.getElementsByName('password_field_no_id')[0].value = 'random';" | 888 "document.getElementsByName('password_field_no_id')[0].value = 'random';" |
889 "document.getElementsByName('input_submit_button_no_id')[0].click()"; | 889 "document.getElementsByName('input_submit_button_no_id')[0].click()"; |
890 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); | 890 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
891 observer.Wait(); | 891 observer.Wait(); |
892 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); | 892 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
893 } | 893 } |
894 | 894 |
895 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, | 895 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
896 NoPromptForInputElementWithoutIdAndName) { | 896 PromptForInputElementWithoutIdAndName) { |
897 // Check that no prompt is shown for forms where the input fields lack both | 897 // Check that prompt is shown for forms where the input fields lack both |
898 // the "id" and the "name" attributes. | 898 // the "id" and the "name" attributes. |
899 NavigateToFile("/password/password_form.html"); | 899 NavigateToFile("/password/password_form.html"); |
900 | 900 |
901 NavigationObserver observer(WebContents()); | 901 NavigationObserver observer(WebContents()); |
902 scoped_ptr<PromptObserver> prompt_observer( | 902 scoped_ptr<PromptObserver> prompt_observer( |
903 PromptObserver::Create(WebContents())); | 903 PromptObserver::Create(WebContents())); |
904 std::string fill_and_submit = | 904 std::string fill_and_submit = |
905 "var form = document.getElementById('testform_elements_no_id_no_name');" | 905 "var form = document.getElementById('testform_elements_no_id_no_name');" |
906 "var username = form.children[0];" | 906 "var username = form.children[0];" |
907 "username.value = 'temp';" | 907 "username.value = 'temp';" |
908 "var password = form.children[1];" | 908 "var password = form.children[1];" |
909 "password.value = 'random';" | 909 "password.value = 'random';" |
910 "form.children[2].click()"; // form.children[2] is the submit button. | 910 "form.children[2].click()"; // form.children[2] is the submit button. |
911 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); | 911 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
912 observer.Wait(); | 912 observer.Wait(); |
913 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); | 913 EXPECT_TRUE(prompt_observer->IsShowingPrompt()); |
dvadym
2015/09/07 15:19:58
Could you please check that correct credential is
Pritam Nikam
2015/09/08 15:09:36
Done.
| |
914 } | 914 } |
915 | 915 |
916 // Test for checking that no prompt is shown for URLs with file: scheme. | 916 // Test for checking that no prompt is shown for URLs with file: scheme. |
917 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, | 917 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase, |
918 NoPromptForFileSchemeURLs) { | 918 NoPromptForFileSchemeURLs) { |
919 GURL url = GetFileURL("password_form.html"); | 919 GURL url = GetFileURL("password_form.html"); |
920 ui_test_utils::NavigateToURL(browser(), url); | 920 ui_test_utils::NavigateToURL(browser(), url); |
921 | 921 |
922 NavigationObserver observer(WebContents()); | 922 NavigationObserver observer(WebContents()); |
923 scoped_ptr<PromptObserver> prompt_observer( | 923 scoped_ptr<PromptObserver> prompt_observer( |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2120 // Spin the message loop to make sure the password store had a chance to | 2120 // Spin the message loop to make sure the password store had a chance to |
2121 // update the password. | 2121 // update the password. |
2122 base::RunLoop run_loop; | 2122 base::RunLoop run_loop; |
2123 run_loop.RunUntilIdle(); | 2123 run_loop.RunUntilIdle(); |
2124 CheckThatCredentialsStored(password_store.get(), base::ASCIIToUTF16("temp"), | 2124 CheckThatCredentialsStored(password_store.get(), base::ASCIIToUTF16("temp"), |
2125 base::ASCIIToUTF16("new_pw")); | 2125 base::ASCIIToUTF16("new_pw")); |
2126 } | 2126 } |
2127 #endif | 2127 #endif |
2128 | 2128 |
2129 } // namespace password_manager | 2129 } // namespace password_manager |
OLD | NEW |