| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 IconsInfo::GetIcons(extension.get()).map().size()); | 143 IconsInfo::GetIcons(extension.get()).map().size()); |
| 144 for (size_t i = 0; i < web_app.icons.size(); ++i) { | 144 for (size_t i = 0; i < web_app.icons.size(); ++i) { |
| 145 EXPECT_EQ(base::StringPrintf("icons/%i.png", web_app.icons[i].width), | 145 EXPECT_EQ(base::StringPrintf("icons/%i.png", web_app.icons[i].width), |
| 146 IconsInfo::GetIcons(extension.get()).Get( | 146 IconsInfo::GetIcons(extension.get()).Get( |
| 147 web_app.icons[i].width, ExtensionIconSet::MATCH_EXACTLY)); | 147 web_app.icons[i].width, ExtensionIconSet::MATCH_EXACTLY)); |
| 148 ExtensionResource resource = | 148 ExtensionResource resource = |
| 149 IconsInfo::GetIconResource(extension.get(), | 149 IconsInfo::GetIconResource(extension.get(), |
| 150 web_app.icons[i].width, | 150 web_app.icons[i].width, |
| 151 ExtensionIconSet::MATCH_EXACTLY); | 151 ExtensionIconSet::MATCH_EXACTLY); |
| 152 ASSERT_TRUE(!resource.empty()); | 152 ASSERT_TRUE(!resource.empty()); |
| 153 EXPECT_TRUE(file_util::PathExists(resource.GetFilePath())); | 153 EXPECT_TRUE(base::PathExists(resource.GetFilePath())); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 | 156 |
| 157 TEST(ExtensionFromWebApp, Minimal) { | 157 TEST(ExtensionFromWebApp, Minimal) { |
| 158 base::ScopedTempDir extensions_dir; | 158 base::ScopedTempDir extensions_dir; |
| 159 ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); | 159 ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); |
| 160 | 160 |
| 161 WebApplicationInfo web_app; | 161 WebApplicationInfo web_app; |
| 162 web_app.manifest_url = GURL("http://aaronboodman.com/gearpad/manifest.json"); | 162 web_app.manifest_url = GURL("http://aaronboodman.com/gearpad/manifest.json"); |
| 163 web_app.title = ASCIIToUTF16("Gearpad"); | 163 web_app.title = ASCIIToUTF16("Gearpad"); |
| (...skipping 19 matching lines...) Expand all 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 |