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

Side by Side Diff: components/precache/core/precache_url_table_unittest.cc

Issue 1851913002: Convert //sql to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU fixup in precache_url_table_unittest.cc Created 4 years, 8 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 | « chrome/browser/predictors/resource_prefetch_predictor_tables.cc ('k') | sql/connection.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/precache/core/precache_url_table.h" 5 #include "components/precache/core/precache_url_table.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory>
8 9
9 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
10 #include "base/time/time.h" 11 #include "base/time/time.h"
11 #include "sql/connection.h" 12 #include "sql/connection.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace precache { 15 namespace precache {
15 16
16 namespace { 17 namespace {
17 18
18 class PrecacheURLTableTest : public testing::Test { 19 class PrecacheURLTableTest : public testing::Test {
19 public: 20 public:
20 PrecacheURLTableTest() {} 21 PrecacheURLTableTest() {}
21 ~PrecacheURLTableTest() override {} 22 ~PrecacheURLTableTest() override {}
22 23
23 protected: 24 protected:
24 void SetUp() override { 25 void SetUp() override {
25 precache_url_table_.reset(new PrecacheURLTable()); 26 precache_url_table_.reset(new PrecacheURLTable());
26 db_.reset(new sql::Connection()); 27 db_.reset(new sql::Connection());
27 ASSERT_TRUE(db_->OpenInMemory()); 28 ASSERT_TRUE(db_->OpenInMemory());
28 precache_url_table_->Init(db_.get()); 29 precache_url_table_->Init(db_.get());
29 } 30 }
30 31
31 scoped_ptr<PrecacheURLTable> precache_url_table_; 32 std::unique_ptr<PrecacheURLTable> precache_url_table_;
32 scoped_ptr<sql::Connection> db_; 33 std::unique_ptr<sql::Connection> db_;
33 }; 34 };
34 35
35 TEST_F(PrecacheURLTableTest, AddURLWithNoExistingRow) { 36 TEST_F(PrecacheURLTableTest, AddURLWithNoExistingRow) {
36 const base::Time kTime = base::Time::FromInternalValue(100); 37 const base::Time kTime = base::Time::FromInternalValue(100);
37 precache_url_table_->AddURL(GURL("http://url.com"), kTime); 38 precache_url_table_->AddURL(GURL("http://url.com"), kTime);
38 39
39 std::map<GURL, base::Time> expected_map; 40 std::map<GURL, base::Time> expected_map;
40 expected_map[GURL("http://url.com")] = kTime; 41 expected_map[GURL("http://url.com")] = kTime;
41 42
42 std::map<GURL, base::Time> actual_map; 43 std::map<GURL, base::Time> actual_map;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 expected_map[GURL("http://after.com")] = kAfterTime; 107 expected_map[GURL("http://after.com")] = kAfterTime;
107 108
108 std::map<GURL, base::Time> actual_map; 109 std::map<GURL, base::Time> actual_map;
109 precache_url_table_->GetAllDataForTesting(&actual_map); 110 precache_url_table_->GetAllDataForTesting(&actual_map);
110 EXPECT_EQ(expected_map, actual_map); 111 EXPECT_EQ(expected_map, actual_map);
111 } 112 }
112 113
113 } // namespace 114 } // namespace
114 115
115 } // namespace precache 116 } // namespace precache
OLDNEW
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_predictor_tables.cc ('k') | sql/connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698