OLD | NEW |
---|---|
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 "chrome/browser/manifest/manifest_icon_downloader.h" | 5 #include "content/public/browser/manifest_icon_downloader.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
13 | 13 |
14 class ManifestIconDownloaderTest : public testing::Test { | 14 namespace content { |
15 | |
16 class ManifestIconDownloaderTest : public testing::Test { | |
15 protected: | 17 protected: |
16 ManifestIconDownloaderTest() = default; | 18 ManifestIconDownloaderTest() = default; |
17 ~ManifestIconDownloaderTest() override = default; | 19 ~ManifestIconDownloaderTest() override = default; |
18 | 20 |
19 int FindBitmap(const int ideal_icon_size_in_px, | 21 int FindBitmap(const int ideal_icon_size_in_px, |
20 const int minimum_icon_size_in_px, | 22 const int minimum_icon_size_in_px, |
21 const std::vector<SkBitmap>& bitmaps) { | 23 const std::vector<SkBitmap>& bitmaps) { |
22 return ManifestIconDownloader::FindClosestBitmapIndex( | 24 return ManifestIconDownloader::FindClosestBitmapIndex( |
23 ideal_icon_size_in_px, minimum_icon_size_in_px, bitmaps); | 25 ideal_icon_size_in_px, minimum_icon_size_in_px, bitmaps); |
24 } | 26 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 ASSERT_EQ(1, FindBitmap(35, 0, bitmaps)); | 135 ASSERT_EQ(1, FindBitmap(35, 0, bitmaps)); |
134 } | 136 } |
135 | 137 |
136 TEST_F(ManifestIconDownloaderTest, NonSquareBelowMinimumIsNotPicked) { | 138 TEST_F(ManifestIconDownloaderTest, NonSquareBelowMinimumIsNotPicked) { |
137 std::vector<SkBitmap> bitmaps; | 139 std::vector<SkBitmap> bitmaps; |
138 bitmaps.push_back(CreateDummyBitmap(10, 15)); | 140 bitmaps.push_back(CreateDummyBitmap(10, 15)); |
139 bitmaps.push_back(CreateDummyBitmap(15, 10)); | 141 bitmaps.push_back(CreateDummyBitmap(15, 10)); |
140 | 142 |
141 ASSERT_EQ(-1, FindBitmap(15, 11, bitmaps)); | 143 ASSERT_EQ(-1, FindBitmap(15, 11, bitmaps)); |
142 } | 144 } |
145 } | |
please use gerrit instead
2017/06/12 23:57:22
newline above
// namespace content
zino
2017/06/13 16:07:44
Done.
| |
OLD | NEW |