Chromium Code Reviews| Index: chrome/browser/password_manager/password_manager_browsertest.cc |
| diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc |
| index fb631fcddb46022fc6bc7fdb7ea8afb9a285b7f6..4a040f7e695277ac3bc0cbe98c0ab8b239bf6235 100644 |
| --- a/chrome/browser/password_manager/password_manager_browsertest.cc |
| +++ b/chrome/browser/password_manager/password_manager_browsertest.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/command_line.h" |
| #include "base/metrics/histogram_samples.h" |
| #include "base/metrics/statistics_recorder.h" |
| +#include "base/path_service.h" |
| #include "base/run_loop.h" |
| #include "base/stl_util.h" |
| #include "base/strings/stringprintf.h" |
| @@ -21,6 +22,7 @@ |
| #include "chrome/browser/ui/login/login_prompt_test_utils.h" |
| #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| +#include "chrome/common/chrome_paths.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/chrome_version_info.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| @@ -41,6 +43,7 @@ |
| #include "content/public/common/content_switches.h" |
| #include "content/public/test/browser_test_utils.h" |
| #include "content/public/test/test_utils.h" |
| +#include "net/base/filename_util.h" |
| #include "net/test/embedded_test_server/embedded_test_server.h" |
| #include "net/test/embedded_test_server/http_request.h" |
| #include "net/test/embedded_test_server/http_response.h" |
| @@ -208,6 +211,14 @@ class BubbleObserver : public PromptObserver { |
| DISALLOW_COPY_AND_ASSIGN(BubbleObserver); |
| }; |
| +static GURL GetFileURL(const char* filename) { |
|
vabr (Chromium)
2014/09/25 11:07:27
Please drop "static". The visibility is local alre
Sunil Ratnu
2014/09/25 11:39:40
Done.
|
| + base::FilePath path; |
| + PathService::Get(chrome::DIR_TEST_DATA, &path); |
| + path = path.AppendASCII("password").AppendASCII(filename); |
| + CHECK(base::PathExists(path)); |
| + return net::FilePathToFileURL(path); |
| +} |
| + |
| // static |
| scoped_ptr<PromptObserver> PromptObserver::Create( |
| content::WebContents* web_contents) { |
| @@ -242,7 +253,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleTestAuthRequest( |
| } |
| } |
| -} // namespace |
| +} // anonymous namespace |
|
vabr (Chromium)
2014/09/25 11:07:27
Just "// namespace", not "anonymous".
See http://g
Sunil Ratnu
2014/09/25 11:39:40
Done.
|
| // PasswordManagerBrowserTest ------------------------------------------------- |
| @@ -825,6 +836,24 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
| EXPECT_FALSE(prompt_observer->IsShowingPrompt()); |
| } |
| +// Test for checking that no prompt is shown for URLs with file: scheme. |
| +IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
| + NoPromptForFileSchemeURLs) { |
| + GURL url = GetFileURL("password_form.html"); |
| + ui_test_utils::NavigateToURL(browser(), url); |
| + |
| + NavigationObserver observer(WebContents()); |
| + scoped_ptr<PromptObserver> prompt_observer( |
| + PromptObserver::Create(WebContents())); |
| + std::string fill_and_submit = |
| + "document.getElementById('username_field').value = 'temp';" |
| + "document.getElementById('password_field').value = 'random';" |
| + "document.getElementById('input_submit_button').click();"; |
| + ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
| + observer.Wait(); |
| + EXPECT_FALSE(prompt_observer->IsShowingPrompt()); |
| +} |
| + |
| IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DeleteFrameBeforeSubmit) { |
| NavigateToFile("/password/multi_frames.html"); |