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" |
| 11 #include "components/suggestions/image_encoder.h" |
11 #include "components/suggestions/image_fetcher.h" | 12 #include "components/suggestions/image_fetcher.h" |
12 #include "components/suggestions/image_fetcher_delegate.h" | 13 #include "components/suggestions/image_fetcher_delegate.h" |
13 #include "components/suggestions/image_manager.h" | 14 #include "components/suggestions/image_manager.h" |
14 #include "components/suggestions/proto/suggestions.pb.h" | 15 #include "components/suggestions/proto/suggestions.pb.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
19 | 20 |
20 #if defined(OS_IOS) | |
21 #include "components/suggestions/image_encoder_ios.h" | |
22 #else | |
23 #include "components/suggestions/image_encoder.h" | |
24 #endif | |
25 | |
26 using ::testing::Return; | 21 using ::testing::Return; |
27 using ::testing::StrictMock; | 22 using ::testing::StrictMock; |
28 using ::testing::_; | 23 using ::testing::_; |
29 | 24 |
30 namespace suggestions { | 25 namespace suggestions { |
31 | 26 |
32 const char kTestUrl1[] = "http://go.com/"; | 27 const char kTestUrl1[] = "http://go.com/"; |
33 const char kTestUrl2[] = "http://goal.com/"; | 28 const char kTestUrl2[] = "http://goal.com/"; |
34 const char kTestImagePath[] = "files/image_decoding/droids.png"; | 29 const char kTestImagePath[] = "files/image_decoding/droids.png"; |
35 const char kInvalidImagePath[] = "files/DOESNOTEXIST"; | 30 const char kInvalidImagePath[] = "files/DOESNOTEXIST"; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 image_manager_->GetImageForURL(GURL(kTestUrl1), | 188 image_manager_->GetImageForURL(GURL(kTestUrl1), |
194 base::Bind(&ImageManagerTest::OnImageAvailable, | 189 base::Bind(&ImageManagerTest::OnImageAvailable, |
195 base::Unretained(this), &run_loop)); | 190 base::Unretained(this), &run_loop)); |
196 run_loop.Run(); | 191 run_loop.Run(); |
197 | 192 |
198 EXPECT_EQ(0, num_callback_null_called_); | 193 EXPECT_EQ(0, num_callback_null_called_); |
199 EXPECT_EQ(1, num_callback_valid_called_); | 194 EXPECT_EQ(1, num_callback_valid_called_); |
200 } | 195 } |
201 | 196 |
202 } // namespace suggestions | 197 } // namespace suggestions |
OLD | NEW |