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 c9644bdc707c9cb6e11c356dd0ae4b92bd1b6507..ec50849dbd2cfd760f1132f5622430c707fcf841 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" |
@@ -271,6 +274,14 @@ class PasswordManagerBrowserTest : public InProcessBrowserTest { |
} |
protected: |
+ static GURL GetURL(const char* filename) { |
vabr (Chromium)
2014/09/25 08:48:02
nit: indenting
(I strongly suggest running git cl
vabr (Chromium)
2014/09/25 08:48:02
This function has nothing to with the test class.
Sunil Ratnu
2014/09/25 10:14:23
Done.
Sunil Ratnu
2014/09/25 10:14:24
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); |
+ } |
+ |
content::WebContents* WebContents() { |
return browser()->tab_strip_model()->GetActiveWebContents(); |
} |
@@ -825,6 +836,25 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
EXPECT_FALSE(prompt_observer->IsShowingPrompt()); |
} |
+IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, |
+ NoPromptForNonWebbyURLs) { |
+ // Check that no prompt is shown for non webby URLs such as file://. |
vabr (Chromium)
2014/09/25 08:48:02
Please simplify the comment to:
// Check that no p
Sunil Ratnu
2014/09/25 10:14:23
Done.
|
+ NavigationObserver observer(WebContents()); |
vabr (Chromium)
2014/09/25 08:48:02
Move the definition of the observer below, just be
Sunil Ratnu
2014/09/25 10:14:23
Done.
|
+ GURL url = GetURL("password_form.html"); |
+ ui_test_utils::NavigateToURL(browser(), url); |
+ observer.Wait(); |
vabr (Chromium)
2014/09/25 08:48:02
Don't Wait() here, NavigateToURL waits for that al
Sunil Ratnu
2014/09/25 10:14:24
Done.
|
+ |
+ 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"); |