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

Side by Side Diff: chrome/browser/privacy_blacklist/blacklist_unittest.cc

Issue 173418: Avoids the use of ToWStringHack in a few places.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « base/file_util_unittest.cc ('k') | chrome/test/selenium/selenium_test.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser/privacy_blacklist/blacklist.h" 5 #include "chrome/browser/privacy_blacklist/blacklist.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "chrome/common/chrome_paths.h" 11 #include "chrome/common/chrome_paths.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 TEST(BlacklistTest, Generic) { 14 TEST(BlacklistTest, Generic) {
15 // Get path relative to test data dir. 15 // Get path relative to test data dir.
16 std::wstring input; 16 FilePath input;
17 PathService::Get(chrome::DIR_TEST_DATA, &input); 17 PathService::Get(chrome::DIR_TEST_DATA, &input);
18 file_util::AppendToPath(&input, L"blacklist_small.pbr"); 18 input = input.AppendASCII("blacklist_small.pbr");
19 19
20 FilePath path = FilePath::FromWStringHack(input); 20 Blacklist blacklist(input);
21 Blacklist blacklist(path);
22 21
23 // This test is a friend, so inspect the internal structures. 22 // This test is a friend, so inspect the internal structures.
24 EXPECT_EQ(5U, blacklist.blacklist_.size()); 23 EXPECT_EQ(5U, blacklist.blacklist_.size());
25 std::vector<Blacklist::Entry*>::const_iterator i = 24 std::vector<Blacklist::Entry*>::const_iterator i =
26 blacklist.blacklist_.begin(); 25 blacklist.blacklist_.begin();
27 26
28 EXPECT_EQ(Blacklist::kBlockByType|Blacklist::kDontPersistCookies, 27 EXPECT_EQ(Blacklist::kBlockByType|Blacklist::kDontPersistCookies,
29 (*i)->attributes()); 28 (*i)->attributes());
30 EXPECT_TRUE((*i)->MatchType("application/x-shockwave-flash")); 29 EXPECT_TRUE((*i)->MatchType("application/x-shockwave-flash"));
31 EXPECT_FALSE((*i)->MatchType("image/jpeg")); 30 EXPECT_FALSE((*i)->MatchType("image/jpeg"));
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 EXPECT_TRUE(Blacklist::Matches("really@bad", "really.com/bad")); 205 EXPECT_TRUE(Blacklist::Matches("really@bad", "really.com/bad"));
207 EXPECT_TRUE(Blacklist::Matches("really@bad", "really.com/path/bad")); 206 EXPECT_TRUE(Blacklist::Matches("really@bad", "really.com/path/bad"));
208 EXPECT_TRUE(Blacklist::Matches("really@bad", "really.evil.com/path/bad")); 207 EXPECT_TRUE(Blacklist::Matches("really@bad", "really.evil.com/path/bad"));
209 EXPECT_FALSE(Blacklist::Matches("really@bad", "really.bad.com")); 208 EXPECT_FALSE(Blacklist::Matches("really@bad", "really.bad.com"));
210 EXPECT_FALSE(Blacklist::Matches("really@bad", "reallybad")); 209 EXPECT_FALSE(Blacklist::Matches("really@bad", "reallybad"));
211 EXPECT_FALSE(Blacklist::Matches("really@bad", ".reallybad")); 210 EXPECT_FALSE(Blacklist::Matches("really@bad", ".reallybad"));
212 EXPECT_FALSE(Blacklist::Matches("really@bad", "reallybad.")); 211 EXPECT_FALSE(Blacklist::Matches("really@bad", "reallybad."));
213 EXPECT_FALSE(Blacklist::Matches("really@bad", "really.bad.")); 212 EXPECT_FALSE(Blacklist::Matches("really@bad", "really.bad."));
214 EXPECT_FALSE(Blacklist::Matches("really@bad", ".really.bad")); 213 EXPECT_FALSE(Blacklist::Matches("really@bad", ".really.bad"));
215 } 214 }
OLDNEW
« no previous file with comments | « base/file_util_unittest.cc ('k') | chrome/test/selenium/selenium_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698