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..cf7f35695964edaab23f7b16cb7b4231c3bb64fa 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); |
}; |
+GURL GetFileURL(const char* filename) { |
+ 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) { |
@@ -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"); |