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

Side by Side Diff: chrome/browser/apps/drive/drive_app_converter_browsertest.cc

Issue 1504453002: Allow arbitrary sizes for extension icons (and bookmark app icons) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test updated Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/apps/drive/drive_app_converter.h" 5 #include "chrome/browser/apps/drive/drive_app_converter.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 runner_->Run(); 64 runner_->Run();
65 } 65 }
66 66
67 GURL GetTestUrl(const std::string& path) { 67 GURL GetTestUrl(const std::string& path) {
68 return embedded_test_server()->base_url().Resolve(path); 68 return embedded_test_server()->base_url().Resolve(path);
69 } 69 }
70 70
71 drive::DriveAppInfo GetTestDriveApp() { 71 drive::DriveAppInfo GetTestDriveApp() {
72 // Define four icons. icon1.png is 16x16 and good to use. icon2.png is 72 // Define four icons. icon1.png is 16x16 and good to use. icon2.png is
73 // 16x16 but claims to be 32x32 and should be dropped. icon3.png is 66x66 73 // 16x16 but claims to be 32x32 and should be dropped. icon3.png is 66x66
74 // and not a valid extension icon size and should be dropped too. The forth 74 // and not a typical icon size but it should be allowed. The fourth one is
75 // one is icon2.png with 16x16 but should be ignored because 16x16 already 75 // icon2.png with 16x16 but should be ignored because 16x16 already has
76 // has icon1.png as its resource. 76 // icon1.png as its resource.
77 drive::DriveAppInfo::IconList app_icons; 77 drive::DriveAppInfo::IconList app_icons;
78 app_icons.push_back(std::make_pair(16, GetTestUrl("extensions/icon1.png"))); 78 app_icons.push_back(std::make_pair(16, GetTestUrl("extensions/icon1.png")));
79 app_icons.push_back(std::make_pair(32, GetTestUrl("extensions/icon2.png"))); 79 app_icons.push_back(std::make_pair(32, GetTestUrl("extensions/icon2.png")));
80 app_icons.push_back(std::make_pair(66, GetTestUrl("extensions/icon3.png"))); 80 app_icons.push_back(std::make_pair(66, GetTestUrl("extensions/icon3.png")));
81 app_icons.push_back(std::make_pair(16, GetTestUrl("extensions/icon2.png"))); 81 app_icons.push_back(std::make_pair(16, GetTestUrl("extensions/icon2.png")));
82 82
83 drive::DriveAppInfo::IconList document_icons; 83 drive::DriveAppInfo::IconList document_icons;
84 84
85 return drive::DriveAppInfo("fake_drive_app_id", 85 return drive::DriveAppInfo("fake_drive_app_id",
86 "fake_product_id", 86 "fake_product_id",
(...skipping 23 matching lines...) Expand all
110 110
111 const Extension* app = converter()->extension(); 111 const Extension* app = converter()->extension();
112 ASSERT_TRUE(app != NULL); 112 ASSERT_TRUE(app != NULL);
113 EXPECT_EQ(kAppName, app->name()); 113 EXPECT_EQ(kAppName, app->name());
114 EXPECT_TRUE(app->is_hosted_app()); 114 EXPECT_TRUE(app->is_hosted_app());
115 EXPECT_TRUE(app->from_bookmark()); 115 EXPECT_TRUE(app->from_bookmark());
116 EXPECT_EQ(GURL(kAppUrl), AppLaunchInfo::GetLaunchWebURL(app)); 116 EXPECT_EQ(GURL(kAppUrl), AppLaunchInfo::GetLaunchWebURL(app));
117 EXPECT_EQ(extensions::LAUNCH_CONTAINER_TAB, 117 EXPECT_EQ(extensions::LAUNCH_CONTAINER_TAB,
118 AppLaunchInfo::GetLaunchContainer(app)); 118 AppLaunchInfo::GetLaunchContainer(app));
119 EXPECT_EQ(0u, app->permissions_data()->active_permissions().apis().size()); 119 EXPECT_EQ(0u, app->permissions_data()->active_permissions().apis().size());
120 EXPECT_EQ(1u, extensions::IconsInfo::GetIcons(app).map().size()); 120 const ExtensionIconSet& icons = extensions::IconsInfo::GetIcons(app);
121 EXPECT_EQ(2u, icons.map().size());
122 EXPECT_FALSE(icons.Get(16, ExtensionIconSet::MATCH_EXACTLY).empty());
123 EXPECT_TRUE(icons.Get(32, ExtensionIconSet::MATCH_EXACTLY).empty());
124 EXPECT_FALSE(icons.Get(66, ExtensionIconSet::MATCH_EXACTLY).empty());
121 125
122 const Extension* installed = extensions::ExtensionSystem::Get(profile()) 126 const Extension* installed = extensions::ExtensionSystem::Get(profile())
123 ->extension_service() 127 ->extension_service()
124 ->GetInstalledExtension(app->id()); 128 ->GetInstalledExtension(app->id());
125 EXPECT_EQ(app, installed); 129 EXPECT_EQ(app, installed);
126 EXPECT_FALSE(extensions::util::ShouldSync(app, profile())); 130 EXPECT_FALSE(extensions::util::ShouldSync(app, profile()));
127 } 131 }
128 132
129 IN_PROC_BROWSER_TEST_F(DriveAppConverterTest, BadApp) { 133 IN_PROC_BROWSER_TEST_F(DriveAppConverterTest, BadApp) {
130 drive::DriveAppInfo no_name = GetTestDriveApp(); 134 drive::DriveAppInfo no_name = GetTestDriveApp();
(...skipping 19 matching lines...) Expand all
150 InstallAndWaitFinish(GetTestDriveApp()); 154 InstallAndWaitFinish(GetTestDriveApp());
151 const Extension* second_install = converter()->extension(); 155 const Extension* second_install = converter()->extension();
152 ASSERT_TRUE(second_install != NULL); 156 ASSERT_TRUE(second_install != NULL);
153 EXPECT_FALSE(converter()->is_new_install()); 157 EXPECT_FALSE(converter()->is_new_install());
154 158
155 // Two different app instances. 159 // Two different app instances.
156 ASSERT_NE(first_install, second_install); 160 ASSERT_NE(first_install, second_install);
157 EXPECT_EQ(first_install_id, second_install->id()); 161 EXPECT_EQ(first_install_id, second_install->id());
158 EXPECT_GE(second_install->version()->CompareTo(first_install_version), 0); 162 EXPECT_GE(second_install->version()->CompareTo(first_install_version), 0);
159 } 163 }
OLDNEW
« no previous file with comments | « chrome/browser/apps/drive/drive_app_converter.cc ('k') | chrome/browser/extensions/bookmark_app_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698