Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 582833005: Save password infobar should only work on schemes on which the bubble does (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing with Nits addressed Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698