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 "components/suggestions/image_manager.h" | 5 #include "components/suggestions/image_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 namespace suggestions { | 35 namespace suggestions { |
36 | 36 |
37 const char kTestUrl1[] = "http://go.com/"; | 37 const char kTestUrl1[] = "http://go.com/"; |
38 const char kTestUrl2[] = "http://goal.com/"; | 38 const char kTestUrl2[] = "http://goal.com/"; |
39 const char kTestImagePath[] = "files/image_decoding/droids.png"; | 39 const char kTestImagePath[] = "files/image_decoding/droids.png"; |
40 const char kInvalidImagePath[] = "files/DOESNOTEXIST"; | 40 const char kInvalidImagePath[] = "files/DOESNOTEXIST"; |
41 | 41 |
42 using leveldb_proto::test::FakeDB; | 42 using leveldb_proto::test::FakeDB; |
43 | 43 |
44 typedef base::hash_map<std::string, ImageData> EntryMap; | 44 typedef std::map<std::string, ImageData> EntryMap; |
45 | 45 |
46 void AddEntry(const ImageData& d, EntryMap* map) { (*map)[d.url()] = d; } | 46 void AddEntry(const ImageData& d, EntryMap* map) { (*map)[d.url()] = d; } |
47 | 47 |
48 class MockImageFetcher : public ImageFetcher { | 48 class MockImageFetcher : public ImageFetcher { |
49 public: | 49 public: |
50 MockImageFetcher() {} | 50 MockImageFetcher() {} |
51 virtual ~MockImageFetcher() {} | 51 virtual ~MockImageFetcher() {} |
52 MOCK_METHOD3(StartOrQueueNetworkRequest, | 52 MOCK_METHOD3(StartOrQueueNetworkRequest, |
53 void(const std::string&, | 53 void(const std::string&, |
54 const GURL&, | 54 const GURL&, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 image_manager_->GetImageForURL(GURL(kTestUrl1), | 219 image_manager_->GetImageForURL(GURL(kTestUrl1), |
220 base::Bind(&ImageManagerTest::OnImageAvailable, | 220 base::Bind(&ImageManagerTest::OnImageAvailable, |
221 base::Unretained(this), &run_loop)); | 221 base::Unretained(this), &run_loop)); |
222 run_loop.Run(); | 222 run_loop.Run(); |
223 | 223 |
224 EXPECT_EQ(0, num_callback_null_called_); | 224 EXPECT_EQ(0, num_callback_null_called_); |
225 EXPECT_EQ(1, num_callback_valid_called_); | 225 EXPECT_EQ(1, num_callback_valid_called_); |
226 } | 226 } |
227 | 227 |
228 } // namespace suggestions | 228 } // namespace suggestions |
OLD | NEW |