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 "extensions/common/url_pattern_set.h" | 5 #include "extensions/common/url_pattern_set.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 AddPattern(&expected, yahoo_a); | 414 AddPattern(&expected, yahoo_a); |
415 AddPattern(&expected, yahoo_b); | 415 AddPattern(&expected, yahoo_b); |
416 AddPattern(&expected, yahoo_c); | 416 AddPattern(&expected, yahoo_c); |
417 AddPattern(&expected, reddit_a); | 417 AddPattern(&expected, reddit_a); |
418 AddPattern(&expected, reddit_b); | 418 AddPattern(&expected, reddit_b); |
419 AddPattern(&expected, reddit_c); | 419 AddPattern(&expected, reddit_c); |
420 EXPECT_EQ(expected, result); | 420 EXPECT_EQ(expected, result); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 TEST(URLPatternSetTest, AddOrigin) { | |
425 URLPatternSet set; | |
426 set.AddOrigin(URLPattern::SCHEME_ALL, GURL("https://www.google.com/")); | |
not at google - send to devlin
2014/08/14 23:04:48
Huh, I would have thought ToOrigin of google.com/
| |
427 EXPECT_TRUE(set.MatchesURL(GURL("https://www.google.com/foo/bar"))); | |
428 EXPECT_FALSE(set.MatchesURL(GURL("http://www.google.com/foo/bar"))); | |
429 EXPECT_FALSE(set.MatchesURL(GURL("https://en.google.com/foo/bar"))); | |
430 set.ClearPatterns(); | |
431 | |
432 set.AddOrigin(URLPattern::SCHEME_ALL, GURL("http://en.foo.com/")); | |
not at google - send to devlin
2014/08/14 23:04:48
there's no difference between this and the google.
gpdavis
2014/08/14 23:31:33
Sure, I can do that.
| |
433 EXPECT_TRUE(set.MatchesURL(GURL("http://en.foo.com/bar"))); | |
434 EXPECT_FALSE(set.MatchesURL(GURL("https://www.foo.com/"))); | |
435 EXPECT_FALSE(set.MatchesURL(GURL("http://www.foo.com/"))); | |
436 } | |
437 | |
424 } // namespace extensions | 438 } // namespace extensions |
OLD | NEW |