Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "extensions/common/url_pattern.h" | 6 #include "extensions/common/url_pattern.h" |
| 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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 EXPECT_TRUE(StrictlyContains(pattern10, pattern11)); | 803 EXPECT_TRUE(StrictlyContains(pattern10, pattern11)); |
| 804 EXPECT_TRUE(StrictlyContains(pattern10, pattern12)); | 804 EXPECT_TRUE(StrictlyContains(pattern10, pattern12)); |
| 805 EXPECT_TRUE(StrictlyContains(pattern10, pattern13)); | 805 EXPECT_TRUE(StrictlyContains(pattern10, pattern13)); |
| 806 | 806 |
| 807 // More... | 807 // More... |
| 808 EXPECT_TRUE(StrictlyContains(pattern12, pattern11)); | 808 EXPECT_TRUE(StrictlyContains(pattern12, pattern11)); |
| 809 EXPECT_TRUE(NeitherContains(pattern11, pattern13)); | 809 EXPECT_TRUE(NeitherContains(pattern11, pattern13)); |
| 810 EXPECT_TRUE(StrictlyContains(pattern12, pattern13)); | 810 EXPECT_TRUE(StrictlyContains(pattern12, pattern13)); |
| 811 } | 811 } |
| 812 | 812 |
| 813 TEST(ExtensionURLPatternTest, MatchesSingleOrigin) { | |
| 814 EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "http://*/") | |
| 815 .MatchesSingleOrigin()); | |
| 816 EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "http://*.google.com/*") | |
|
not at google - send to devlin
2014/08/12 19:49:27
mix up the http and https in here?
gpdavis
2014/08/12 21:19:55
Sure.
| |
| 817 .MatchesSingleOrigin()); | |
| 818 EXPECT_TRUE(URLPattern(URLPattern::SCHEME_ALL, "http://www.google.com/") | |
|
not at google - send to devlin
2014/08/12 19:49:27
could you test http://google.com here as well?
gpdavis
2014/08/12 21:19:55
http://google.com doesn't parse due to an invalid
not at google - send to devlin
2014/08/12 23:13:18
Yes add http://google.com/ and/or http://google.co
gpdavis
2014/08/13 00:08:24
Gotcha.
| |
| 819 .MatchesSingleOrigin()); | |
| 820 EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "*://www.google.com/") | |
| 821 .MatchesSingleOrigin()); | |
|
not at google - send to devlin
2014/08/12 19:49:27
also test a wildcard port
gpdavis
2014/08/12 21:19:56
See previous comment about port issue. Calling po
| |
| 822 EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "http://*.com/") | |
| 823 .MatchesSingleOrigin()); | |
| 824 EXPECT_FALSE(URLPattern(URLPattern::SCHEME_ALL, "http://*.google.com/foo/bar") | |
| 825 .MatchesSingleOrigin()); | |
| 826 EXPECT_TRUE(URLPattern(URLPattern::SCHEME_ALL, | |
| 827 "http://www.google.com/foo/bar") | |
| 828 .MatchesSingleOrigin()); | |
|
not at google - send to devlin
2014/08/12 19:49:27
also add a couple of tests with a URLPattern mask
gpdavis
2014/08/12 21:19:56
You mean like...
EXPECT_FALSE(URLPattern(URLPatte
not at google - send to devlin
2014/08/12 23:13:18
No, I mean like
EXPECT_FALSE(URLPattern(URLPatter
gpdavis
2014/08/13 00:08:24
Ahh, that's what you meant by URLPattern mask. Bu
not at google - send to devlin
2014/08/13 01:02:59
Oh yeah, I'm thinking of AddOrigin. Sorry!
gpdavis
2014/08/13 01:14:50
No problem!
| |
| 829 } | |
| 830 | |
| 813 } // namespace | 831 } // namespace |
| OLD | NEW |