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

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

Issue 2916753004: Use BookmarkAppConfirmationView on Mac. Delete the NSAlert Mac uses currently. (Closed)
Patch Set: using, OnceCallback Created 3 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
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/extensions/bookmark_app_helper.h" 5 #include "chrome/browser/extensions/bookmark_app_helper.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/banners/app_banner_settings_helper.h" 9 #include "chrome/browser/banners/app_banner_settings_helper.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 std::map<int, BookmarkAppHelper::BitmapAndSource> size_map = 270 std::map<int, BookmarkAppHelper::BitmapAndSource> size_map =
271 BookmarkAppHelper::ResizeIconsAndGenerateMissing( 271 BookmarkAppHelper::ResizeIconsAndGenerateMissing(
272 downloaded, TestSizesToGenerate(), &web_app_info); 272 downloaded, TestSizesToGenerate(), &web_app_info);
273 273
274 ValidateIconsGeneratedAndResizedCorrectly(downloaded, size_map, 274 ValidateIconsGeneratedAndResizedCorrectly(downloaded, size_map,
275 TestSizesToGenerate(), 275 TestSizesToGenerate(),
276 expected_generated, 276 expected_generated,
277 expected_resized); 277 expected_resized);
278 } 278 }
279 279
280 } // namespace
281
282 class TestBookmarkAppHelper : public BookmarkAppHelper { 280 class TestBookmarkAppHelper : public BookmarkAppHelper {
283 public: 281 public:
284 TestBookmarkAppHelper(ExtensionService* service, 282 TestBookmarkAppHelper(ExtensionService* service,
285 WebApplicationInfo web_app_info, 283 WebApplicationInfo web_app_info,
286 content::WebContents* contents) 284 content::WebContents* contents)
287 : BookmarkAppHelper(service->profile(), web_app_info, contents) {} 285 : BookmarkAppHelper(service->profile(), web_app_info, contents) {}
288 286
289 ~TestBookmarkAppHelper() override {} 287 ~TestBookmarkAppHelper() override {}
290 288
291 void CreationComplete(const extensions::Extension* extension, 289 void CreationComplete(const extensions::Extension* extension,
(...skipping 12 matching lines...) Expand all
304 } 302 }
305 303
306 const Extension* extension() { return extension_; } 304 const Extension* extension() { return extension_; }
307 305
308 private: 306 private:
309 const Extension* extension_; 307 const Extension* extension_;
310 308
311 DISALLOW_COPY_AND_ASSIGN(TestBookmarkAppHelper); 309 DISALLOW_COPY_AND_ASSIGN(TestBookmarkAppHelper);
312 }; 310 };
313 311
312 } // namespace
313
314 TEST_F(BookmarkAppHelperExtensionServiceTest, CreateBookmarkApp) { 314 TEST_F(BookmarkAppHelperExtensionServiceTest, CreateBookmarkApp) {
315 WebApplicationInfo web_app_info; 315 WebApplicationInfo web_app_info;
316 web_app_info.app_url = GURL(kAppUrl); 316 web_app_info.app_url = GURL(kAppUrl);
317 web_app_info.title = base::UTF8ToUTF16(kAppTitle); 317 web_app_info.title = base::UTF8ToUTF16(kAppTitle);
318 web_app_info.description = base::UTF8ToUTF16(kAppDescription); 318 web_app_info.description = base::UTF8ToUTF16(kAppDescription);
319 319
320 std::unique_ptr<content::WebContents> contents( 320 std::unique_ptr<content::WebContents> contents(
321 content::WebContentsTester::CreateTestWebContents(profile(), nullptr)); 321 content::WebContentsTester::CreateTestWebContents(profile(), nullptr));
322 TestBookmarkAppHelper helper(service_, web_app_info, contents.get()); 322 TestBookmarkAppHelper helper(service_, web_app_info, contents.get());
323 helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete, 323 helper.Create(base::Bind(&TestBookmarkAppHelper::CreationComplete,
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 TestIconGeneration(kIconSizeTiny, 0, 3); 773 TestIconGeneration(kIconSizeTiny, 0, 3);
774 } 774 }
775 775
776 TEST_F(BookmarkAppHelperTest, IconsResizedWhenOnlyAGigantorOneIsProvided) { 776 TEST_F(BookmarkAppHelperTest, IconsResizedWhenOnlyAGigantorOneIsProvided) {
777 // When an enormous icon is provided, each desired icon size should be resized 777 // When an enormous icon is provided, each desired icon size should be resized
778 // from it, and no icons should be generated. 778 // from it, and no icons should be generated.
779 TestIconGeneration(kIconSizeGigantor, 0, 3); 779 TestIconGeneration(kIconSizeGigantor, 0, 3);
780 } 780 }
781 781
782 } // namespace extensions 782 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/bookmark_app_helper_browsertest.cc ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698