OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/favicon/favicon_url_parser.h" | 5 #include "chrome/common/favicon/favicon_url_parser.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "components/favicon_base/favicon_types.h" | 8 #include "components/favicon_base/favicon_types.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/base/layout.h" | 10 #include "ui/base/layout.h" |
11 | 11 |
12 class FaviconUrlParserTest : public testing::Test { | 12 class FaviconUrlParserTest : public testing::Test { |
13 public: | 13 public: |
14 FaviconUrlParserTest() { | 14 FaviconUrlParserTest() { |
15 // Set the supported scale factors because the supported scale factors | 15 // Set the supported scale factors because the supported scale factors |
16 // affect the result of ParsePathAndScale(). | 16 // affect the result of ParsePathAndScale(). |
17 std::vector<ui::ScaleFactor> supported_scale_factors; | 17 std::vector<ui::ScaleFactor> supported_scale_factors; |
18 supported_scale_factors.push_back(ui::SCALE_FACTOR_100P); | 18 supported_scale_factors.push_back(ui::SCALE_FACTOR_100P); |
19 supported_scale_factors.push_back(ui::SCALE_FACTOR_140P); | 19 supported_scale_factors.push_back(ui::SCALE_FACTOR_140P); |
20 scoped_set_supported_scale_factors_.reset( | 20 scoped_set_supported_scale_factors_.reset( |
21 new ui::test::ScopedSetSupportedScaleFactors(supported_scale_factors)); | 21 new ui::test::ScopedSetSupportedScaleFactors(supported_scale_factors)); |
22 } | 22 } |
23 | 23 |
24 virtual ~FaviconUrlParserTest() { | 24 ~FaviconUrlParserTest() override {} |
25 } | |
26 | 25 |
27 private: | 26 private: |
28 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> | 27 typedef scoped_ptr<ui::test::ScopedSetSupportedScaleFactors> |
29 ScopedSetSupportedScaleFactors; | 28 ScopedSetSupportedScaleFactors; |
30 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; | 29 ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; |
31 | 30 |
32 DISALLOW_COPY_AND_ASSIGN(FaviconUrlParserTest); | 31 DISALLOW_COPY_AND_ASSIGN(FaviconUrlParserTest); |
33 }; | 32 }; |
34 | 33 |
35 // Test parsing path with no extra parameters. | 34 // Test parsing path with no extra parameters. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 EXPECT_EQ(32, parsed.size_in_dip); | 156 EXPECT_EQ(32, parsed.size_in_dip); |
158 EXPECT_EQ(1.4f, parsed.device_scale_factor); | 157 EXPECT_EQ(1.4f, parsed.device_scale_factor); |
159 | 158 |
160 const std::string path14 = | 159 const std::string path14 = |
161 "largest/iconurl/http://www.google.com/favicon.ico"; | 160 "largest/iconurl/http://www.google.com/favicon.ico"; |
162 EXPECT_TRUE(chrome::ParseFaviconPath(path14, icon_types, &parsed)); | 161 EXPECT_TRUE(chrome::ParseFaviconPath(path14, icon_types, &parsed)); |
163 EXPECT_TRUE(parsed.is_icon_url); | 162 EXPECT_TRUE(parsed.is_icon_url); |
164 EXPECT_EQ("http://www.google.com/favicon.ico", parsed.url); | 163 EXPECT_EQ("http://www.google.com/favicon.ico", parsed.url); |
165 EXPECT_EQ(0, parsed.size_in_dip); | 164 EXPECT_EQ(0, parsed.size_in_dip); |
166 } | 165 } |
OLD | NEW |