| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "content/public/browser/web_contents_observer.h" | 47 #include "content/public/browser/web_contents_observer.h" |
| 48 #include "content/public/common/content_switches.h" | 48 #include "content/public/common/content_switches.h" |
| 49 #include "content/public/test/browser_test_utils.h" | 49 #include "content/public/test/browser_test_utils.h" |
| 50 #include "content/public/test/test_utils.h" | 50 #include "content/public/test/test_utils.h" |
| 51 #include "ipc/ipc_security_test_util.h" | 51 #include "ipc/ipc_security_test_util.h" |
| 52 #include "net/base/filename_util.h" | 52 #include "net/base/filename_util.h" |
| 53 #include "net/dns/mock_host_resolver.h" | 53 #include "net/dns/mock_host_resolver.h" |
| 54 #include "net/test/embedded_test_server/embedded_test_server.h" | 54 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 55 #include "net/test/embedded_test_server/http_request.h" | 55 #include "net/test/embedded_test_server/http_request.h" |
| 56 #include "net/test/embedded_test_server/http_response.h" | 56 #include "net/test/embedded_test_server/http_response.h" |
| 57 #include "net/test/spawned_test_server/spawned_test_server.h" | |
| 58 #include "net/url_request/test_url_fetcher_factory.h" | 57 #include "net/url_request/test_url_fetcher_factory.h" |
| 59 #include "testing/gmock/include/gmock/gmock.h" | 58 #include "testing/gmock/include/gmock/gmock.h" |
| 60 #include "third_party/WebKit/public/web/WebInputEvent.h" | 59 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 61 #include "ui/events/keycodes/keyboard_codes.h" | 60 #include "ui/events/keycodes/keyboard_codes.h" |
| 62 #include "ui/gfx/geometry/point.h" | 61 #include "ui/gfx/geometry/point.h" |
| 63 | 62 |
| 64 using testing::_; | 63 using testing::_; |
| 65 | 64 |
| 66 namespace { | 65 namespace { |
| 67 | 66 |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 | 1339 |
| 1341 IN_PROC_BROWSER_TEST_F( | 1340 IN_PROC_BROWSER_TEST_F( |
| 1342 PasswordManagerBrowserTestBase, | 1341 PasswordManagerBrowserTestBase, |
| 1343 NoPromptForLoginFailedAndServerPushSeperateLoginForm_HttpsToHttp) { | 1342 NoPromptForLoginFailedAndServerPushSeperateLoginForm_HttpsToHttp) { |
| 1344 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1343 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1345 ::switches::kAllowRunningInsecureContent); | 1344 ::switches::kAllowRunningInsecureContent); |
| 1346 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 1345 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1347 ::switches::kIgnoreCertificateErrors); | 1346 ::switches::kIgnoreCertificateErrors); |
| 1348 const base::FilePath::CharType kDocRoot[] = | 1347 const base::FilePath::CharType kDocRoot[] = |
| 1349 FILE_PATH_LITERAL("chrome/test/data"); | 1348 FILE_PATH_LITERAL("chrome/test/data"); |
| 1350 net::SpawnedTestServer https_test_server( | 1349 net::EmbeddedTestServer https_test_server( |
| 1351 net::SpawnedTestServer::TYPE_HTTPS, | 1350 net::EmbeddedTestServer::TYPE_HTTPS); |
| 1352 net::SpawnedTestServer::SSLOptions( | 1351 https_test_server.ServeFilesFromSourceDirectory(base::FilePath(kDocRoot)); |
| 1353 net::SpawnedTestServer::SSLOptions::CERT_OK), | |
| 1354 base::FilePath(kDocRoot)); | |
| 1355 ASSERT_TRUE(https_test_server.Start()); | 1352 ASSERT_TRUE(https_test_server.Start()); |
| 1356 | 1353 |
| 1357 // This test case cannot inject the scripts via content::ExecuteScript() in | 1354 // This test case cannot inject the scripts via content::ExecuteScript() in |
| 1358 // files served through HTTPS. Therefore the scripts are made part of the HTML | 1355 // files served through HTTPS. Therefore the scripts are made part of the HTML |
| 1359 // site and executed on load. | 1356 // site and executed on load. |
| 1360 std::string path = | 1357 std::string path = |
| 1361 "password/separate_login_form_with_onload_submit_script.html"; | 1358 "/password/separate_login_form_with_onload_submit_script.html"; |
| 1362 GURL https_url(https_test_server.GetURL(path)); | 1359 GURL https_url(https_test_server.GetURL(path)); |
| 1363 ASSERT_TRUE(https_url.SchemeIs(url::kHttpsScheme)); | 1360 ASSERT_TRUE(https_url.SchemeIs(url::kHttpsScheme)); |
| 1364 | 1361 |
| 1365 NavigationObserver observer(WebContents()); | 1362 NavigationObserver observer(WebContents()); |
| 1366 scoped_ptr<PromptObserver> prompt_observer( | 1363 scoped_ptr<PromptObserver> prompt_observer( |
| 1367 PromptObserver::Create(WebContents())); | 1364 PromptObserver::Create(WebContents())); |
| 1368 ui_test_utils::NavigateToURL(browser(), https_url); | 1365 ui_test_utils::NavigateToURL(browser(), https_url); |
| 1369 | 1366 |
| 1370 observer.SetPathToWaitFor("/password/done_and_separate_login_form.html"); | 1367 observer.SetPathToWaitFor("/password/done_and_separate_login_form.html"); |
| 1371 observer.Wait(); | 1368 observer.Wait(); |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2640 std::string get_password = | 2637 std::string get_password = |
| 2641 "window.domAutomationController.send(" | 2638 "window.domAutomationController.send(" |
| 2642 " document.getElementById('hidden_password_form').elements[2].value);"; | 2639 " document.getElementById('hidden_password_form').elements[2].value);"; |
| 2643 std::string actual_password; | 2640 std::string actual_password; |
| 2644 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 2641 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 2645 RenderViewHost(), get_password, &actual_password)); | 2642 RenderViewHost(), get_password, &actual_password)); |
| 2646 EXPECT_EQ("mypassword", actual_password); | 2643 EXPECT_EQ("mypassword", actual_password); |
| 2647 } | 2644 } |
| 2648 | 2645 |
| 2649 } // namespace password_manager | 2646 } // namespace password_manager |
| OLD | NEW |