OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/convert_web_app.h" | 5 #include "chrome/browser/extensions/convert_web_app.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 icon_file = icon_file.AppendASCII("extensions") | 45 icon_file = icon_file.AppendASCII("extensions") |
46 .AppendASCII("convert_web_app") | 46 .AppendASCII("convert_web_app") |
47 .AppendASCII(base::StringPrintf("%i.png", size)); | 47 .AppendASCII(base::StringPrintf("%i.png", size)); |
48 | 48 |
49 result.url = url; | 49 result.url = url; |
50 result.width = size; | 50 result.width = size; |
51 result.height = size; | 51 result.height = size; |
52 | 52 |
53 std::string icon_data; | 53 std::string icon_data; |
54 if (!file_util::ReadFileToString(icon_file, &icon_data)) { | 54 if (!base::ReadFileToString(icon_file, &icon_data)) { |
55 ADD_FAILURE() << "Could not read test icon."; | 55 ADD_FAILURE() << "Could not read test icon."; |
56 return result; | 56 return result; |
57 } | 57 } |
58 | 58 |
59 if (!gfx::PNGCodec::Decode( | 59 if (!gfx::PNGCodec::Decode( |
60 reinterpret_cast<const unsigned char*>(icon_data.c_str()), | 60 reinterpret_cast<const unsigned char*>(icon_data.c_str()), |
61 icon_data.size(), &result.data)) { | 61 icon_data.size(), &result.data)) { |
62 ADD_FAILURE() << "Could not decode test icon."; | 62 ADD_FAILURE() << "Could not decode test icon."; |
63 return result; | 63 return result; |
64 } | 64 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 EXPECT_EQ("", extension->description()); | 183 EXPECT_EQ("", extension->description()); |
184 EXPECT_EQ(web_app.app_url, AppLaunchInfo::GetFullLaunchURL(extension.get())); | 184 EXPECT_EQ(web_app.app_url, AppLaunchInfo::GetFullLaunchURL(extension.get())); |
185 EXPECT_EQ(0u, IconsInfo::GetIcons(extension.get()).map().size()); | 185 EXPECT_EQ(0u, IconsInfo::GetIcons(extension.get()).map().size()); |
186 EXPECT_EQ(0u, extension->GetActivePermissions()->apis().size()); | 186 EXPECT_EQ(0u, extension->GetActivePermissions()->apis().size()); |
187 ASSERT_EQ(1u, extension->web_extent().patterns().size()); | 187 ASSERT_EQ(1u, extension->web_extent().patterns().size()); |
188 EXPECT_EQ("*://aaronboodman.com/*", | 188 EXPECT_EQ("*://aaronboodman.com/*", |
189 extension->web_extent().patterns().begin()->GetAsString()); | 189 extension->web_extent().patterns().begin()->GetAsString()); |
190 } | 190 } |
191 | 191 |
192 } // namespace extensions | 192 } // namespace extensions |
OLD | NEW |