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

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

Issue 2656453002: Remove password manager's dependency of BrowsingDataHelper (Closed)
Patch Set: s/spec/possibly_invalid_spec/ Created 3 years, 11 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
Index: chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
diff --git a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
index df6f06ed08b0eb742120af71e2f282b941af3c46..b8245851c0f80bdb4dc08cbc37eb17e30bc99078 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -12,6 +12,7 @@
#include "base/metrics/field_trial.h"
#include "base/run_loop.h"
#include "base/strings/string16.h"
+#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
@@ -39,12 +40,18 @@
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/url_constants.h"
#include "content/public/test/web_contents_tester.h"
+#include "extensions/features/features.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+#include "extensions/common/constants.h"
+#endif
+
using browser_sync::ProfileSyncServiceMock;
using content::BrowserContext;
using content::WebContents;
@@ -526,3 +533,37 @@ TEST_F(ChromePasswordManagerClientTest, BindCredentialManager_MissingInstance) {
web_contents->GetMainFrame(),
password_manager::mojom::CredentialManagerRequest());
}
+
+TEST_F(ChromePasswordManagerClientTest, CanShowBubbleOnURL) {
+ struct TestCase {
+ const char* scheme;
+ bool can_show_bubble;
+ } kTestCases[] = {
+ {url::kHttpScheme, true},
+ {url::kHttpsScheme, true},
+ {url::kFtpScheme, true},
+ {url::kDataScheme, true},
+ {"feed", true},
+ {url::kBlobScheme, true},
+ {url::kFileSystemScheme, true},
+
+ {"invalid-scheme-i-just-made-up", false},
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ {extensions::kExtensionScheme, false},
+#endif
+ {url::kAboutScheme, false},
+ {content::kChromeDevToolsScheme, false},
+ {content::kChromeUIScheme, false},
+ {url::kJavaScriptScheme, false},
+ {url::kMailToScheme, false},
+ {content::kViewSourceScheme, false},
+ };
+
+ for (const TestCase& test_case : kTestCases) {
+ // CanShowBubbleOnURL currently only depends on the scheme.
+ GURL url(base::StringPrintf("%s://example.org", test_case.scheme));
+ SCOPED_TRACE(url.possibly_invalid_spec());
+ EXPECT_EQ(test_case.can_show_bubble,
+ ChromePasswordManagerClient::CanShowBubbleOnURL(url));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698