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

Side by Side Diff: components/offline_pages/offline_page_metadata_store_impl_unittest.cc

Issue 1551433002: Switch to standard integer types in components/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/offline_pages/offline_page_metadata_store_impl.h" 5 #include "components/offline_pages/offline_page_metadata_store_impl.h"
6 6
7 #include <stdint.h>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
12 #include "base/test/test_simple_task_runner.h" 14 #include "base/test/test_simple_task_runner.h"
13 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
14 #include "components/leveldb_proto/proto_database_impl.h" 16 #include "components/leveldb_proto/proto_database_impl.h"
15 #include "components/offline_pages/offline_page_item.h" 17 #include "components/offline_pages/offline_page_item.h"
16 #include "components/offline_pages/proto/offline_pages.pb.h" 18 #include "components/offline_pages/proto/offline_pages.pb.h"
17 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
18 20
19 using leveldb_proto::ProtoDatabaseImpl; 21 using leveldb_proto::ProtoDatabaseImpl;
20 22
21 namespace offline_pages { 23 namespace offline_pages {
22 24
23 namespace { 25 namespace {
24 26
25 const char kTestURL[] = "https://example.com"; 27 const char kTestURL[] = "https://example.com";
26 const int64 kTestBookmarkId = 1234LL; 28 const int64_t kTestBookmarkId = 1234LL;
27 const base::FilePath::CharType kFilePath[] = 29 const base::FilePath::CharType kFilePath[] =
28 FILE_PATH_LITERAL("/offline_pages/example_com.mhtml"); 30 FILE_PATH_LITERAL("/offline_pages/example_com.mhtml");
29 int64 kFileSize = 234567; 31 int64_t kFileSize = 234567;
30 32
31 class OfflinePageMetadataStoreImplTest : public testing::Test { 33 class OfflinePageMetadataStoreImplTest : public testing::Test {
32 public: 34 public:
33 enum CalledCallback { NONE, LOAD, ADD, REMOVE, DESTROY }; 35 enum CalledCallback { NONE, LOAD, ADD, REMOVE, DESTROY };
34 enum Status { STATUS_NONE, STATUS_TRUE, STATUS_FALSE }; 36 enum Status { STATUS_NONE, STATUS_TRUE, STATUS_FALSE };
35 37
36 OfflinePageMetadataStoreImplTest(); 38 OfflinePageMetadataStoreImplTest();
37 ~OfflinePageMetadataStoreImplTest() override; 39 ~OfflinePageMetadataStoreImplTest() override;
38 40
39 void TearDown() override { 41 void TearDown() override {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 ClearResults(); 173 ClearResults();
172 174
173 // Load the store. 175 // Load the store.
174 store->Load(base::Bind(&OfflinePageMetadataStoreImplTest::LoadCallback, 176 store->Load(base::Bind(&OfflinePageMetadataStoreImplTest::LoadCallback,
175 base::Unretained(this))); 177 base::Unretained(this)));
176 PumpLoop(); 178 PumpLoop();
177 EXPECT_EQ(LOAD, last_called_callback_); 179 EXPECT_EQ(LOAD, last_called_callback_);
178 EXPECT_EQ(1U, offline_pages_.size()); 180 EXPECT_EQ(1U, offline_pages_.size());
179 181
180 // Remove the offline page. 182 // Remove the offline page.
181 std::vector<int64> ids_to_remove; 183 std::vector<int64_t> ids_to_remove;
182 ids_to_remove.push_back(offline_page.bookmark_id); 184 ids_to_remove.push_back(offline_page.bookmark_id);
183 store->RemoveOfflinePages( 185 store->RemoveOfflinePages(
184 ids_to_remove, 186 ids_to_remove,
185 base::Bind(&OfflinePageMetadataStoreImplTest::UpdateCallback, 187 base::Bind(&OfflinePageMetadataStoreImplTest::UpdateCallback,
186 base::Unretained(this), REMOVE)); 188 base::Unretained(this), REMOVE));
187 PumpLoop(); 189 PumpLoop();
188 EXPECT_EQ(REMOVE, last_called_callback_); 190 EXPECT_EQ(REMOVE, last_called_callback_);
189 EXPECT_EQ(STATUS_TRUE, last_status_); 191 EXPECT_EQ(STATUS_TRUE, last_status_);
190 192
191 ClearResults(); 193 ClearResults();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Load the store. 244 // Load the store.
243 store->Load(base::Bind(&OfflinePageMetadataStoreImplTest::LoadCallback, 245 store->Load(base::Bind(&OfflinePageMetadataStoreImplTest::LoadCallback,
244 base::Unretained(this))); 246 base::Unretained(this)));
245 PumpLoop(); 247 PumpLoop();
246 248
247 EXPECT_EQ(LOAD, last_called_callback_); 249 EXPECT_EQ(LOAD, last_called_callback_);
248 EXPECT_EQ(STATUS_TRUE, last_status_); 250 EXPECT_EQ(STATUS_TRUE, last_status_);
249 EXPECT_EQ(2U, offline_pages_.size()); 251 EXPECT_EQ(2U, offline_pages_.size());
250 252
251 // Remove the offline page. 253 // Remove the offline page.
252 std::vector<int64> ids_to_remove; 254 std::vector<int64_t> ids_to_remove;
253 ids_to_remove.push_back(offline_page_1.bookmark_id); 255 ids_to_remove.push_back(offline_page_1.bookmark_id);
254 store->RemoveOfflinePages( 256 store->RemoveOfflinePages(
255 ids_to_remove, 257 ids_to_remove,
256 base::Bind(&OfflinePageMetadataStoreImplTest::UpdateCallback, 258 base::Bind(&OfflinePageMetadataStoreImplTest::UpdateCallback,
257 base::Unretained(this), REMOVE)); 259 base::Unretained(this), REMOVE));
258 PumpLoop(); 260 PumpLoop();
259 EXPECT_EQ(REMOVE, last_called_callback_); 261 EXPECT_EQ(REMOVE, last_called_callback_);
260 EXPECT_EQ(STATUS_TRUE, last_status_); 262 EXPECT_EQ(STATUS_TRUE, last_status_);
261 263
262 ClearResults(); 264 ClearResults();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 EXPECT_EQ(offline_page.file_path, offline_pages_[0].file_path); 341 EXPECT_EQ(offline_page.file_path, offline_pages_[0].file_path);
340 EXPECT_EQ(offline_page.file_size, offline_pages_[0].file_size); 342 EXPECT_EQ(offline_page.file_size, offline_pages_[0].file_size);
341 EXPECT_EQ(offline_page.creation_time, offline_pages_[0].creation_time); 343 EXPECT_EQ(offline_page.creation_time, offline_pages_[0].creation_time);
342 EXPECT_EQ(offline_page.last_access_time, offline_pages_[0].last_access_time); 344 EXPECT_EQ(offline_page.last_access_time, offline_pages_[0].last_access_time);
343 EXPECT_EQ(offline_page.access_count, offline_pages_[0].access_count); 345 EXPECT_EQ(offline_page.access_count, offline_pages_[0].access_count);
344 } 346 }
345 347
346 } // namespace 348 } // namespace
347 349
348 } // namespace offline_pages 350 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_metadata_store_impl.cc ('k') | components/offline_pages/offline_page_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698