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

Side by Side Diff: components/enhanced_bookmarks/image_store_unittest.cc

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/enhanced_bookmarks/image_store.h" 5 #include "components/enhanced_bookmarks/image_store.h"
6 6
7 #include <stdint.h>
8
7 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/macros.h"
9 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "build/build_config.h"
10 #include "components/enhanced_bookmarks/image_record.h" 14 #include "components/enhanced_bookmarks/image_record.h"
11 #include "components/enhanced_bookmarks/image_store_util.h" 15 #include "components/enhanced_bookmarks/image_store_util.h"
12 #include "components/enhanced_bookmarks/persistent_image_store.h" 16 #include "components/enhanced_bookmarks/persistent_image_store.h"
13 #include "components/enhanced_bookmarks/test_image_store.h" 17 #include "components/enhanced_bookmarks/test_image_store.h"
14 #include "sql/statement.h" 18 #include "sql/statement.h"
15 #include "testing/platform_test.h" 19 #include "testing/platform_test.h"
16 #include "third_party/skia/include/core/SkBitmap.h" 20 #include "third_party/skia/include/core/SkBitmap.h"
17 #include "third_party/skia/include/core/SkColor.h" 21 #include "third_party/skia/include/core/SkColor.h"
18 #include "url/gurl.h" 22 #include "url/gurl.h"
19 23
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 this->store_->Get(GURL("foo://bar")); 307 this->store_->Get(GURL("foo://bar"));
304 EXPECT_EQ(SK_ColorWHITE, image_out->dominant_color); 308 EXPECT_EQ(SK_ColorWHITE, image_out->dominant_color);
305 } 309 }
306 310
307 TYPED_TEST(ImageStoreUnitTest, GetSize) { 311 TYPED_TEST(ImageStoreUnitTest, GetSize) {
308 const GURL url("foo://bar"); 312 const GURL url("foo://bar");
309 scoped_refptr<enhanced_bookmarks::ImageRecord> image_in( 313 scoped_refptr<enhanced_bookmarks::ImageRecord> image_in(
310 new enhanced_bookmarks::ImageRecord( 314 new enhanced_bookmarks::ImageRecord(
311 GenerateBlackImage(), GURL("http://a.jpg"), SK_ColorBLACK)); 315 GenerateBlackImage(), GURL("http://a.jpg"), SK_ColorBLACK));
312 316
313 int64 size = 0; 317 int64_t size = 0;
314 if (this->use_persistent_store()) { 318 if (this->use_persistent_store()) {
315 // File shouldn't exist before we actually start using it since we do lazy 319 // File shouldn't exist before we actually start using it since we do lazy
316 // initialization. 320 // initialization.
317 EXPECT_EQ(this->store_->GetStoreSizeInBytes(), -1); 321 EXPECT_EQ(this->store_->GetStoreSizeInBytes(), -1);
318 } else { 322 } else {
319 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 1024); 323 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 1024);
320 } 324 }
321 for (int i = 0; i < 100; ++i) { 325 for (int i = 0; i < 100; ++i) {
322 this->store_->Insert(GURL(url.spec() + '/' + base::IntToString(i)), 326 this->store_->Insert(GURL(url.spec() + '/' + base::IntToString(i)),
323 image_in); 327 image_in);
324 EXPECT_GE(this->store_->GetStoreSizeInBytes(), size); 328 EXPECT_GE(this->store_->GetStoreSizeInBytes(), size);
325 size = this->store_->GetStoreSizeInBytes(); 329 size = this->store_->GetStoreSizeInBytes();
326 } 330 }
327 331
328 if (this->use_persistent_store()) { 332 if (this->use_persistent_store()) {
329 EXPECT_GE(this->store_->GetStoreSizeInBytes(), 80 * 1024); // 80kb 333 EXPECT_GE(this->store_->GetStoreSizeInBytes(), 80 * 1024); // 80kb
330 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 200 * 1024); // 200kb 334 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 200 * 1024); // 200kb
331 } else { 335 } else {
332 EXPECT_GE(this->store_->GetStoreSizeInBytes(), 400 * 1024); // 400kb 336 EXPECT_GE(this->store_->GetStoreSizeInBytes(), 400 * 1024); // 400kb
333 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 500 * 1024); // 500kb 337 EXPECT_LE(this->store_->GetStoreSizeInBytes(), 500 * 1024); // 500kb
334 } 338 }
335 } 339 }
336 340
337 } // namespace 341 } // namespace
OLDNEW
« no previous file with comments | « components/enhanced_bookmarks/image_store_ios_unittest.mm ('k') | components/enhanced_bookmarks/image_store_util_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698