OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "components/leveldb_proto/proto_database.h" | 9 #include "components/leveldb_proto/proto_database.h" |
10 #include "components/leveldb_proto/testing/fake_db.h" | 10 #include "components/leveldb_proto/testing/fake_db.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 MOCK_METHOD1(SetImageFetcherDelegate, void(ImageFetcherDelegate*)); | 46 MOCK_METHOD1(SetImageFetcherDelegate, void(ImageFetcherDelegate*)); |
47 }; | 47 }; |
48 | 48 |
49 class ImageManagerTest : public testing::Test { | 49 class ImageManagerTest : public testing::Test { |
50 public: | 50 public: |
51 ImageManagerTest() | 51 ImageManagerTest() |
52 : mock_image_fetcher_(NULL), | 52 : mock_image_fetcher_(NULL), |
53 num_callback_null_called_(0), | 53 num_callback_null_called_(0), |
54 num_callback_valid_called_(0) {} | 54 num_callback_valid_called_(0) {} |
55 | 55 |
56 virtual void SetUp() OVERRIDE { | 56 virtual void SetUp() override { |
57 fake_db_ = new FakeDB<ImageData>(&db_model_); | 57 fake_db_ = new FakeDB<ImageData>(&db_model_); |
58 image_manager_.reset(CreateImageManager(fake_db_)); | 58 image_manager_.reset(CreateImageManager(fake_db_)); |
59 } | 59 } |
60 | 60 |
61 virtual void TearDown() OVERRIDE { | 61 virtual void TearDown() override { |
62 fake_db_ = NULL; | 62 fake_db_ = NULL; |
63 db_model_.clear(); | 63 db_model_.clear(); |
64 image_manager_.reset(); | 64 image_manager_.reset(); |
65 } | 65 } |
66 | 66 |
67 void InitializeDefaultImageMapAndDatabase(ImageManager* image_manager, | 67 void InitializeDefaultImageMapAndDatabase(ImageManager* image_manager, |
68 FakeDB<ImageData>* fake_db) { | 68 FakeDB<ImageData>* fake_db) { |
69 CHECK(image_manager); | 69 CHECK(image_manager); |
70 CHECK(fake_db); | 70 CHECK(fake_db); |
71 | 71 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 image_manager_->GetImageForURL(GURL(kTestUrl1), | 187 image_manager_->GetImageForURL(GURL(kTestUrl1), |
188 base::Bind(&ImageManagerTest::OnImageAvailable, | 188 base::Bind(&ImageManagerTest::OnImageAvailable, |
189 base::Unretained(this), &run_loop)); | 189 base::Unretained(this), &run_loop)); |
190 run_loop.Run(); | 190 run_loop.Run(); |
191 | 191 |
192 EXPECT_EQ(0, num_callback_null_called_); | 192 EXPECT_EQ(0, num_callback_null_called_); |
193 EXPECT_EQ(1, num_callback_valid_called_); | 193 EXPECT_EQ(1, num_callback_valid_called_); |
194 } | 194 } |
195 | 195 |
196 } // namespace suggestions | 196 } // namespace suggestions |
OLD | NEW |