diff options
author | lshang <lshang@chromium.org> | 2016-03-21 17:08:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 00:09:23 +0000 |
commit | 41052729d42a2d5486191139dc73865f86e11810 (patch) | |
tree | efd210567ae320fa66f63323146cc08bc2bf0eb9 | |
parent | b5c3a06bf018465da44edde5d7bdf70485f7e7b0 (diff) | |
download | chromium_src-41052729d42a2d5486191139dc73865f86e11810.zip chromium_src-41052729d42a2d5486191139dc73865f86e11810.tar.gz chromium_src-41052729d42a2d5486191139dc73865f86e11810.tar.bz2 |
Add DCHECK for primary_url and secondary_url in HostContentSettingsMap::GetPatternsFromScopingType
Add checks to ensure that primary_url or secondary_url is not empty when
generating patterns.
Also assigns an url to download unit tests.
BUG=551747
Review URL: https://codereview.chromium.org/1767083004
Cr-Commit-Position: refs/heads/master@{#382448}
-rw-r--r-- | chrome/browser/download/download_request_limiter_unittest.cc | 5 | ||||
-rw-r--r-- | components/content_settings/core/browser/host_content_settings_map.cc | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc index 7a3bf4a..91e9425 100644 --- a/chrome/browser/download/download_request_limiter_unittest.cc +++ b/chrome/browser/download/download_request_limiter_unittest.cc @@ -253,6 +253,7 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness { }; TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_Allow) { + NavigateAndCommit(GURL("http://foo.com/bar")); LoadCompleted(); // All tabs should initially start at ALLOW_ONE_DOWNLOAD. @@ -463,6 +464,10 @@ TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_ResetOnReload) { TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_RawWebContents) { scoped_ptr<WebContents> web_contents(CreateTestWebContents()); + GURL url("http://foo.com/bar"); + web_contents->GetController().LoadURL( + url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); + // DownloadRequestLimiter won't try to make a permission bubble if there's // no permission bubble manager, so don't put one on the test WebContents. diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc index d1151ea..02ec6d5 100644 --- a/components/content_settings/core/browser/host_content_settings_map.cc +++ b/components/content_settings/core/browser/host_content_settings_map.cc @@ -112,6 +112,7 @@ content_settings::PatternPair GetPatternsFromScopingType( WebsiteSettingsInfo::ScopingType scoping_type, const GURL& primary_url, const GURL& secondary_url) { + DCHECK(!primary_url.is_empty()); content_settings::PatternPair patterns; switch (scoping_type) { @@ -125,6 +126,7 @@ content_settings::PatternPair GetPatternsFromScopingType( patterns.second = ContentSettingsPattern::Wildcard(); break; case WebsiteSettingsInfo::REQUESTING_ORIGIN_AND_TOP_LEVEL_ORIGIN_SCOPE: + DCHECK(!secondary_url.is_empty()); patterns.first = ContentSettingsPattern::FromURLNoWildcard(primary_url); patterns.second = ContentSettingsPattern::FromURLNoWildcard(secondary_url); |