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

Side by Side Diff: extensions/common/url_pattern_set_unittest.cc

Issue 396033002: Support "always allow" for runtime script execution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: S'more changes Created 6 years, 4 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
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 "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
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/"));
Devlin 2014/08/15 15:10:31 Should probably say EXPECT_TRUE()
gpdavis 2014/08/15 18:08:27 Done.
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("https://google.com/"));
Devlin 2014/08/15 15:10:31 Should probably also say EXPECT_TRUE()
gpdavis 2014/08/15 18:08:27 Done.
433 EXPECT_FALSE(set.MatchesURL(GURL("https://www.google.com/foo/bar")));
434 EXPECT_TRUE(set.MatchesURL(GURL("https://google.com/foo/bar")));
Devlin 2014/08/15 15:10:31 For kicks and grins, can we also test an AddOrigin
gpdavis 2014/08/15 18:08:27 Done.
435 }
436
424 } // namespace extensions 437 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698