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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
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 // Unit tests for the SafeBrowsing storage system. 5 // Unit tests for the SafeBrowsing storage system.
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/message_loop.h" 10 #include "base/message_loop.h"
10 #include "base/scoped_temp_dir.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "chrome/browser/safe_browsing/safe_browsing_database.h" 12 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
13 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" 13 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
14 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" 14 #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h"
15 #include "content/public/test/test_browser_thread.h" 15 #include "content/public/test/test_browser_thread.h"
16 #include "crypto/sha2.h" 16 #include "crypto/sha2.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "sql/connection.h" 18 #include "sql/connection.h"
19 #include "sql/statement.h" 19 #include "sql/statement.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 void SubDelChunk(const std::string& list, int chunk_id) { 261 void SubDelChunk(const std::string& list, int chunk_id) {
262 DelChunk(list, chunk_id, true); 262 DelChunk(list, chunk_id, true);
263 } 263 }
264 264
265 // Utility function for setting up the database for the caching test. 265 // Utility function for setting up the database for the caching test.
266 void PopulateDatabaseForCacheTest(); 266 void PopulateDatabaseForCacheTest();
267 267
268 scoped_ptr<SafeBrowsingDatabaseNew> database_; 268 scoped_ptr<SafeBrowsingDatabaseNew> database_;
269 FilePath database_filename_; 269 FilePath database_filename_;
270 ScopedTempDir temp_dir_; 270 base::ScopedTempDir temp_dir_;
271 }; 271 };
272 272
273 // Tests retrieving list name information. 273 // Tests retrieving list name information.
274 TEST_F(SafeBrowsingDatabaseTest, ListNameForBrowse) { 274 TEST_F(SafeBrowsingDatabaseTest, ListNameForBrowse) {
275 SBChunkList chunks; 275 SBChunkList chunks;
276 SBChunk chunk; 276 SBChunk chunk;
277 277
278 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/", 278 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
279 "www.evil.com/malware.html"); 279 "www.evil.com/malware.html");
280 chunks.clear(); 280 chunks.clear();
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 ASSERT_FALSE(file_util::PathExists(filter_file)); 1638 ASSERT_FALSE(file_util::PathExists(filter_file));
1639 database_.reset(new SafeBrowsingDatabaseNew); 1639 database_.reset(new SafeBrowsingDatabaseNew);
1640 database_->Init(database_filename_); 1640 database_->Init(database_filename_);
1641 EXPECT_FALSE(database_->ContainsBrowseUrl( 1641 EXPECT_FALSE(database_->ContainsBrowseUrl(
1642 GURL("http://www.evil.com/malware.html"), 1642 GURL("http://www.evil.com/malware.html"),
1643 &matching_list, &prefix_hits, &full_hashes, now)); 1643 &matching_list, &prefix_hits, &full_hashes, now));
1644 EXPECT_FALSE(database_->ContainsBrowseUrl( 1644 EXPECT_FALSE(database_->ContainsBrowseUrl(
1645 GURL("http://www.good.com/goodware.html"), 1645 GURL("http://www.good.com/goodware.html"),
1646 &matching_list, &prefix_hits, &full_hashes, now)); 1646 &matching_list, &prefix_hits, &full_hashes, now));
1647 } 1647 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/prefix_set_unittest.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698