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

Side by Side Diff: components/content_settings/core/common/content_settings_pattern_unittest.cc

Issue 2909273003: Replace raw ptr from ContentSettingsPattern Builder with unique_ptr (Closed)
Patch Set: remove more auto Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « components/content_settings/core/common/content_settings_pattern.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/content_settings/core/common/content_settings_pattern.h" 5 #include "components/content_settings/core/common/content_settings_pattern.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "url/gurl.h" 8 #include "url/gurl.h"
9 9
10 namespace { 10 namespace {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 GURL("filesystem:https://www.google.com/persistent/"))); 177 GURL("filesystem:https://www.google.com/persistent/")));
178 EXPECT_FALSE(pattern.Matches( 178 EXPECT_FALSE(pattern.Matches(
179 GURL("filesystem:https://www.google.com:81/temporary/"))); 179 GURL("filesystem:https://www.google.com:81/temporary/")));
180 EXPECT_FALSE(pattern.Matches( 180 EXPECT_FALSE(pattern.Matches(
181 GURL("filesystem:https://foo.www.google.com/temporary/"))); 181 GURL("filesystem:https://foo.www.google.com/temporary/")));
182 } 182 }
183 183
184 // The static Wildcard() method goes through a fast path and avoids the Builder 184 // The static Wildcard() method goes through a fast path and avoids the Builder
185 // pattern. Ensure that it yields the exact same behavior. 185 // pattern. Ensure that it yields the exact same behavior.
186 TEST(ContentSettingsPatternTest, ValidWildcardFastPath) { 186 TEST(ContentSettingsPatternTest, ValidWildcardFastPath) {
187 std::unique_ptr<ContentSettingsPattern::BuilderInterface> builder( 187 std::unique_ptr<ContentSettingsPattern::BuilderInterface> builder =
188 ContentSettingsPattern::CreateBuilder(true)); 188 ContentSettingsPattern::CreateBuilder();
189 builder->WithSchemeWildcard()->WithDomainWildcard()->WithPortWildcard()-> 189 builder->WithSchemeWildcard()->WithDomainWildcard()->WithPortWildcard()->
190 WithPathWildcard(); 190 WithPathWildcard();
191 ContentSettingsPattern built_wildcard = builder->Build(); 191 ContentSettingsPattern built_wildcard = builder->Build();
192 EXPECT_EQ(built_wildcard, ContentSettingsPattern::Wildcard()); 192 EXPECT_EQ(built_wildcard, ContentSettingsPattern::Wildcard());
193 } 193 }
194 194
195 TEST(ContentSettingsPatternTest, Wildcard) { 195 TEST(ContentSettingsPatternTest, Wildcard) {
196 EXPECT_TRUE(ContentSettingsPattern::Wildcard().IsValid()); 196 EXPECT_TRUE(ContentSettingsPattern::Wildcard().IsValid());
197 197
198 EXPECT_TRUE(ContentSettingsPattern::Wildcard().Matches( 198 EXPECT_TRUE(ContentSettingsPattern::Wildcard().Matches(
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 EXPECT_EQ(ContentSettingsPattern::SCHEME_OTHER, 838 EXPECT_EQ(ContentSettingsPattern::SCHEME_OTHER,
839 Pattern("filesystem:http://www.google.com/temporary/").GetScheme()); 839 Pattern("filesystem:http://www.google.com/temporary/").GetScheme());
840 } 840 }
841 841
842 TEST(ContentSettingsPatternTest, FileSchemeHasPath) { 842 TEST(ContentSettingsPatternTest, FileSchemeHasPath) {
843 EXPECT_FALSE(Pattern("file:///*").HasPath()); 843 EXPECT_FALSE(Pattern("file:///*").HasPath());
844 EXPECT_TRUE(Pattern("file:///foo").HasPath()); 844 EXPECT_TRUE(Pattern("file:///foo").HasPath());
845 EXPECT_TRUE(Pattern("file:///foo/bar/").HasPath()); 845 EXPECT_TRUE(Pattern("file:///foo/bar/").HasPath());
846 EXPECT_TRUE(Pattern("file:///foo/bar/test.html").HasPath()); 846 EXPECT_TRUE(Pattern("file:///foo/bar/test.html").HasPath());
847 } 847 }
OLDNEW
« no previous file with comments | « components/content_settings/core/common/content_settings_pattern.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698