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

Side by Side Diff: chrome/browser/content_settings/content_settings_pattern_unittest.cc

Issue 7229005: Include port when creating a pattern for a HTTPS URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/content_settings/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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/content_settings/content_settings_pattern.h" 5 #include "chrome/browser/content_settings/content_settings_pattern.h"
6 6
7 #include "googleurl/src/gurl.h" 7 #include "googleurl/src/gurl.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace { 10 namespace {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com"))); 67 EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com")));
68 68
69 pattern = ContentSettingsPattern::FromURL(GURL("http://www.google.com:80")); 69 pattern = ContentSettingsPattern::FromURL(GURL("http://www.google.com:80"));
70 EXPECT_TRUE(pattern.Matches(GURL("http://www.google.com"))); 70 EXPECT_TRUE(pattern.Matches(GURL("http://www.google.com")));
71 EXPECT_TRUE(pattern.Matches(GURL("http://www.google.com:80"))); 71 EXPECT_TRUE(pattern.Matches(GURL("http://www.google.com:80")));
72 EXPECT_TRUE(pattern.Matches(GURL("http://www.google.com:81"))); 72 EXPECT_TRUE(pattern.Matches(GURL("http://www.google.com:81")));
73 73
74 pattern = ContentSettingsPattern::FromURL(GURL("https://www.google.com:443")); 74 pattern = ContentSettingsPattern::FromURL(GURL("https://www.google.com:443"));
75 EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com"))); 75 EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com")));
76 EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com:443"))); 76 EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com:443")));
77 EXPECT_TRUE(pattern.Matches(GURL("https://www.google.com:444"))); 77 EXPECT_FALSE(pattern.Matches(GURL("https://www.google.com:444")));
78 EXPECT_FALSE(pattern.Matches(GURL("http://www.google.com:443"))); 78 EXPECT_FALSE(pattern.Matches(GURL("http://www.google.com:443")));
79 79
80 pattern = ContentSettingsPattern::FromURL(GURL("https://127.0.0.1")); 80 pattern = ContentSettingsPattern::FromURL(GURL("https://127.0.0.1"));
81 EXPECT_TRUE(pattern.IsValid()); 81 EXPECT_TRUE(pattern.IsValid());
82 EXPECT_STREQ("https://127.0.0.1", pattern.ToString().c_str()); 82 EXPECT_STREQ("https://127.0.0.1:443", pattern.ToString().c_str());
83 83
84 pattern = ContentSettingsPattern::FromURL(GURL("http://[::1]")); 84 pattern = ContentSettingsPattern::FromURL(GURL("http://[::1]"));
85 EXPECT_TRUE(pattern.IsValid()); 85 EXPECT_TRUE(pattern.IsValid());
86 86
87 pattern = ContentSettingsPattern::FromURL(GURL("file:///foo/bar.html")); 87 pattern = ContentSettingsPattern::FromURL(GURL("file:///foo/bar.html"));
88 EXPECT_TRUE(pattern.IsValid()); 88 EXPECT_TRUE(pattern.IsValid());
89 EXPECT_STREQ("file:///foo/bar.html", pattern.ToString().c_str()); 89 EXPECT_STREQ("file:///foo/bar.html", pattern.ToString().c_str());
90 } 90 }
91 91
92 TEST(ContentSettingsPatternTest, FromURLNoWildcard) { 92 TEST(ContentSettingsPatternTest, FromURLNoWildcard) {
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // file:/// normalization. 557 // file:/// normalization.
558 EXPECT_STREQ("file:///tmp/test.html", 558 EXPECT_STREQ("file:///tmp/test.html",
559 Pattern("file:///tmp/bar/../test.html").ToString().c_str()); 559 Pattern("file:///tmp/bar/../test.html").ToString().c_str());
560 560
561 // Invalid patterns. 561 // Invalid patterns.
562 EXPECT_STREQ("", Pattern("*example.com").ToString().c_str()); 562 EXPECT_STREQ("", Pattern("*example.com").ToString().c_str());
563 EXPECT_STREQ("", Pattern("example.*").ToString().c_str()); 563 EXPECT_STREQ("", Pattern("example.*").ToString().c_str());
564 EXPECT_STREQ("", Pattern("*\xC4\x87ira.com").ToString().c_str()); 564 EXPECT_STREQ("", Pattern("*\xC4\x87ira.com").ToString().c_str());
565 EXPECT_STREQ("", Pattern("\xC4\x87ira.*").ToString().c_str()); 565 EXPECT_STREQ("", Pattern("\xC4\x87ira.*").ToString().c_str());
566 } 566 }
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/content_settings_pattern.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698