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

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

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 // Unit tests for the SafeBrowsing storage system. 5 // Unit tests for the SafeBrowsing storage system.
6 6
7 #include "chrome/browser/safe_browsing/safe_browsing_database.h" 7 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <utility>
10 11
11 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
15 #include "base/sha1.h" 16 #include "base/sha1.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_split.h" 18 #include "base/strings/string_split.h"
18 #include "base/test/test_simple_task_runner.h" 19 #include "base/test/test_simple_task_runner.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 scoped_ptr<ChunkData> raw_data(new ChunkData); 73 scoped_ptr<ChunkData> raw_data(new ChunkData);
73 raw_data->set_chunk_number(chunk_number); 74 raw_data->set_chunk_number(chunk_number);
74 raw_data->set_chunk_type(chunk_type); 75 raw_data->set_chunk_type(chunk_type);
75 raw_data->set_prefix_type(prefix_type); 76 raw_data->set_prefix_type(prefix_type);
76 raw_data->set_hashes(data, data_size); 77 raw_data->set_hashes(data, data_size);
77 raw_data->clear_add_numbers(); 78 raw_data->clear_add_numbers();
78 for (size_t i = 0; i < add_chunk_numbers.size(); ++i) { 79 for (size_t i = 0; i < add_chunk_numbers.size(); ++i) {
79 raw_data->add_add_numbers(add_chunk_numbers[i]); 80 raw_data->add_add_numbers(add_chunk_numbers[i]);
80 } 81 }
81 82
82 return make_scoped_ptr(new SBChunkData(raw_data.Pass())); 83 return make_scoped_ptr(new SBChunkData(std::move(raw_data)));
83 } 84 }
84 85
85 // Create add chunk with a single prefix. 86 // Create add chunk with a single prefix.
86 scoped_ptr<SBChunkData> AddChunkPrefix(int chunk_number, SBPrefix prefix) { 87 scoped_ptr<SBChunkData> AddChunkPrefix(int chunk_number, SBPrefix prefix) {
87 return BuildChunk(chunk_number, ChunkData::ADD, ChunkData::PREFIX_4B, &prefix, 88 return BuildChunk(chunk_number, ChunkData::ADD, ChunkData::PREFIX_4B, &prefix,
88 sizeof(prefix), std::vector<int>()); 89 sizeof(prefix), std::vector<int>());
89 } 90 }
90 91
91 // Create add chunk with a single prefix generated from |value|. 92 // Create add chunk with a single prefix generated from |value|.
92 scoped_ptr<SBChunkData> AddChunkPrefixValue(int chunk_number, 93 scoped_ptr<SBChunkData> AddChunkPrefixValue(int chunk_number,
(...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 ASSERT_EQ(1U, prefix_hits.size()); 2228 ASSERT_EQ(1U, prefix_hits.size());
2228 EXPECT_EQ(SBPrefixForString(kExampleCollision), prefix_hits[0]); 2229 EXPECT_EQ(SBPrefixForString(kExampleCollision), prefix_hits[0]);
2229 EXPECT_TRUE(cache_hits.empty()); 2230 EXPECT_TRUE(cache_hits.empty());
2230 2231
2231 // This prefix collides, but no full hash match. 2232 // This prefix collides, but no full hash match.
2232 EXPECT_FALSE(database_->ContainsBrowseUrl( 2233 EXPECT_FALSE(database_->ContainsBrowseUrl(
2233 GURL(std::string("http://") + kExampleFine), &prefix_hits, &cache_hits)); 2234 GURL(std::string("http://") + kExampleFine), &prefix_hits, &cache_hits));
2234 } 2235 }
2235 2236
2236 } // namespace safe_browsing 2237 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698