Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: chrome/browser/extensions/convert_web_app_unittest.cc

Issue 308003005: app_list: Drive app integration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: format Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 web_app.app_url = GURL("http://aaronboodman.com/gearpad/"); 104 web_app.app_url = GURL("http://aaronboodman.com/gearpad/");
105 105
106 const int sizes[] = {16, 48, 128}; 106 const int sizes[] = {16, 48, 128};
107 for (size_t i = 0; i < arraysize(sizes); ++i) { 107 for (size_t i = 0; i < arraysize(sizes); ++i) {
108 GURL icon_url( 108 GURL icon_url(
109 web_app.app_url.Resolve(base::StringPrintf("%i.png", sizes[i]))); 109 web_app.app_url.Resolve(base::StringPrintf("%i.png", sizes[i])));
110 web_app.icons.push_back(GetIconInfo(icon_url, sizes[i])); 110 web_app.icons.push_back(GetIconInfo(icon_url, sizes[i]));
111 } 111 }
112 112
113 scoped_refptr<Extension> extension = ConvertWebAppToExtension( 113 scoped_refptr<Extension> extension = ConvertWebAppToExtension(
114 web_app, GetTestTime(1978, 12, 11, 0, 0, 0, 0), 114 web_app, GetTestTime(1978, 12, 11, 0, 0, 0, 0), Extension::FROM_BOOKMARK,
115 extensions_dir.path()); 115 extensions_dir.path());
116 ASSERT_TRUE(extension.get()); 116 ASSERT_TRUE(extension.get());
117 117
118 base::ScopedTempDir extension_dir; 118 base::ScopedTempDir extension_dir;
119 EXPECT_TRUE(extension_dir.Set(extension->path())); 119 EXPECT_TRUE(extension_dir.Set(extension->path()));
120 120
121 EXPECT_TRUE(extension->is_app()); 121 EXPECT_TRUE(extension->is_app());
122 EXPECT_TRUE(extension->is_hosted_app()); 122 EXPECT_TRUE(extension->is_hosted_app());
123 EXPECT_FALSE(extension->is_legacy_packaged_app()); 123 EXPECT_FALSE(extension->is_legacy_packaged_app());
124 124
(...skipping 24 matching lines...) Expand all
149 149
150 TEST(ExtensionFromWebApp, Minimal) { 150 TEST(ExtensionFromWebApp, Minimal) {
151 base::ScopedTempDir extensions_dir; 151 base::ScopedTempDir extensions_dir;
152 ASSERT_TRUE(extensions_dir.CreateUniqueTempDir()); 152 ASSERT_TRUE(extensions_dir.CreateUniqueTempDir());
153 153
154 WebApplicationInfo web_app; 154 WebApplicationInfo web_app;
155 web_app.title = base::ASCIIToUTF16("Gearpad"); 155 web_app.title = base::ASCIIToUTF16("Gearpad");
156 web_app.app_url = GURL("http://aaronboodman.com/gearpad/"); 156 web_app.app_url = GURL("http://aaronboodman.com/gearpad/");
157 157
158 scoped_refptr<Extension> extension = ConvertWebAppToExtension( 158 scoped_refptr<Extension> extension = ConvertWebAppToExtension(
159 web_app, GetTestTime(1978, 12, 11, 0, 0, 0, 0), 159 web_app, GetTestTime(1978, 12, 11, 0, 0, 0, 0), Extension::FROM_BOOKMARK,
160 extensions_dir.path()); 160 extensions_dir.path());
161 ASSERT_TRUE(extension.get()); 161 ASSERT_TRUE(extension.get());
162 162
163 base::ScopedTempDir extension_dir; 163 base::ScopedTempDir extension_dir;
164 EXPECT_TRUE(extension_dir.Set(extension->path())); 164 EXPECT_TRUE(extension_dir.Set(extension->path()));
165 165
166 EXPECT_TRUE(extension->is_app()); 166 EXPECT_TRUE(extension->is_app());
167 EXPECT_TRUE(extension->is_hosted_app()); 167 EXPECT_TRUE(extension->is_hosted_app());
168 EXPECT_FALSE(extension->is_legacy_packaged_app()); 168 EXPECT_FALSE(extension->is_legacy_packaged_app());
169 169
170 EXPECT_EQ("zVvdNZy3Mp7CFU8JVSyXNlDuHdVLbP7fDO3TGVzj/0w=", 170 EXPECT_EQ("zVvdNZy3Mp7CFU8JVSyXNlDuHdVLbP7fDO3TGVzj/0w=",
171 extension->public_key()); 171 extension->public_key());
172 EXPECT_EQ("oplhagaaipaimkjlbekcdjkffijdockj", extension->id()); 172 EXPECT_EQ("oplhagaaipaimkjlbekcdjkffijdockj", extension->id());
173 EXPECT_EQ("1978.12.11.0", extension->version()->GetString()); 173 EXPECT_EQ("1978.12.11.0", extension->version()->GetString());
174 EXPECT_EQ(base::UTF16ToUTF8(web_app.title), extension->name()); 174 EXPECT_EQ(base::UTF16ToUTF8(web_app.title), extension->name());
175 EXPECT_EQ("", extension->description()); 175 EXPECT_EQ("", extension->description());
176 EXPECT_EQ(web_app.app_url, AppLaunchInfo::GetFullLaunchURL(extension.get())); 176 EXPECT_EQ(web_app.app_url, AppLaunchInfo::GetFullLaunchURL(extension.get()));
177 EXPECT_EQ(0u, IconsInfo::GetIcons(extension.get()).map().size()); 177 EXPECT_EQ(0u, IconsInfo::GetIcons(extension.get()).map().size());
178 EXPECT_EQ(0u, extension->GetActivePermissions()->apis().size()); 178 EXPECT_EQ(0u, extension->GetActivePermissions()->apis().size());
179 ASSERT_EQ(0u, extension->web_extent().patterns().size()); 179 ASSERT_EQ(0u, extension->web_extent().patterns().size());
180 } 180 }
181 181
182 } // namespace extensions 182 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698