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

Side by Side Diff: chrome/common/extensions/extension_extent_unittest.cc

Issue 2870027: Fix a memory leak in ExtensionExtentUnittest by fixing a bad (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: remove unneeded header from url_pattern.h Created 10 years, 5 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
« no previous file with comments | « no previous file | chrome/common/extensions/url_pattern.h » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.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 TEST(ExtensionExtentTest, Empty) { 10 TEST(ExtensionExtentTest, Empty) {
11 ExtensionExtent extent; 11 ExtensionExtent extent;
12 EXPECT_FALSE(extent.ContainsURL(GURL("http://www.foo.com/bar"))); 12 EXPECT_FALSE(extent.ContainsURL(GURL("http://www.foo.com/bar")));
13 EXPECT_FALSE(extent.ContainsURL(GURL())); 13 EXPECT_FALSE(extent.ContainsURL(GURL()));
14 EXPECT_FALSE(extent.ContainsURL(GURL("invalid"))); 14 EXPECT_FALSE(extent.ContainsURL(GURL("invalid")));
15 } 15 }
16 16
17 TEST(ExtensionExtentTest, One) { 17 TEST(ExtensionExtentTest, One) {
18 ExtensionExtent extent; 18 ExtensionExtent extent;
19 extent.AddPattern(*URLPattern::CreateFromString("http://www.google.com/*")); 19 extent.AddPattern(URLPattern("http://www.google.com/*"));
20 20
21 EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/"))); 21 EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/")));
22 EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/monkey"))); 22 EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/monkey")));
23 EXPECT_FALSE(extent.ContainsURL(GURL("https://www.google.com/"))); 23 EXPECT_FALSE(extent.ContainsURL(GURL("https://www.google.com/")));
24 EXPECT_FALSE(extent.ContainsURL(GURL("https://www.microsoft.com/"))); 24 EXPECT_FALSE(extent.ContainsURL(GURL("https://www.microsoft.com/")));
25 } 25 }
26 26
27 TEST(ExtensionExtentTest, Two) { 27 TEST(ExtensionExtentTest, Two) {
28 ExtensionExtent extent; 28 ExtensionExtent extent;
29 extent.AddPattern(*URLPattern::CreateFromString("http://www.google.com/*")); 29 extent.AddPattern(URLPattern("http://www.google.com/*"));
30 extent.AddPattern(*URLPattern::CreateFromString("http://www.yahoo.com/*")); 30 extent.AddPattern(URLPattern("http://www.yahoo.com/*"));
31 31
32 EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/monkey"))); 32 EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/monkey")));
33 EXPECT_TRUE(extent.ContainsURL(GURL("http://www.yahoo.com/monkey"))); 33 EXPECT_TRUE(extent.ContainsURL(GURL("http://www.yahoo.com/monkey")));
34 EXPECT_FALSE(extent.ContainsURL(GURL("https://www.apple.com/monkey"))); 34 EXPECT_FALSE(extent.ContainsURL(GURL("https://www.apple.com/monkey")));
35 } 35 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/url_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698