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 URLPattern pattern1(URLPattern::SCHEME_ALL); | |
| 815 URLPattern pattern2(URLPattern::SCHEME_ALL); | |
| 816 URLPattern pattern3(URLPattern::SCHEME_ALL); | |
| 817 | |
| 818 EXPECT_EQ(URLPattern::PARSE_SUCCESS, pattern1.Parse("http://*/*")); | |
| 819 EXPECT_EQ(URLPattern::PARSE_SUCCESS, pattern2.Parse("http://*.google.com/*")); | |
| 820 EXPECT_EQ(URLPattern::PARSE_SUCCESS, pattern3.Parse("http://www.google.com/*") ); | |
| 821 | |
| 822 EXPECT_FALSE(pattern1.MatchesSingleOrigin()); | |
| 823 EXPECT_FALSE(pattern2.MatchesSingleOrigin()); | |
| 824 EXPECT_TRUE(pattern3.MatchesSingleOrigin()); | |
|
not at google - send to devlin
2014/08/11 22:59:30
I think it's unnecessarily complex to be making th
gpdavis
2014/08/12 00:52:06
Shouldn't MatchesSingleOrigin also check the schem
not at google - send to devlin
2014/08/12 19:49:26
Yes it should check the scheme and port.
| |
| 825 } | |
| 826 | |
| 813 } // namespace | 827 } // namespace |
| OLD | NEW |