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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_action_button_interactive_uitest.mm

Issue 2409443002: Make GlobalErrorService's ownership model slightly less insane. (Closed)
Patch Set: commentary Created 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" 5 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/callback_helpers.h" 13 #include "base/callback_helpers.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
18 #include "chrome/browser/extensions/extension_action_test_util.h" 19 #include "chrome/browser/extensions/extension_action_test_util.h"
19 #include "chrome/browser/extensions/extension_browsertest.h" 20 #include "chrome/browser/extensions/extension_browsertest.h"
20 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/ui/browser_window.h" 22 #include "chrome/browser/ui/browser_window.h"
22 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h" 23 #import "chrome/browser/ui/cocoa/app_menu/app_menu_controller.h"
23 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 24 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
24 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" 25 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h"
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 }; 478 };
478 479
479 // Test the layout with gradually more extensions hidden. 480 // Test the layout with gradually more extensions hidden.
480 for (int i = 1; i <= kNumExtensions; ++i) 481 for (int i = 1; i <= kNumExtensions; ++i)
481 resizeAndActivateAppMenu(i, base::StringPrintf("Normal: %d", i)); 482 resizeAndActivateAppMenu(i, base::StringPrintf("Normal: %d", i));
482 483
483 // Adding a global error adjusts the app menu size, and has been known to mess 484 // Adding a global error adjusts the app menu size, and has been known to mess
484 // up the overflow container's bounds (crbug.com/511326). 485 // up the overflow container's bounds (crbug.com/511326).
485 GlobalErrorService* error_service = 486 GlobalErrorService* error_service =
486 GlobalErrorServiceFactory::GetForProfile(profile()); 487 GlobalErrorServiceFactory::GetForProfile(profile());
487 error_service->AddGlobalError(new MenuError()); 488 error_service->AddGlobalError(base::MakeUnique<MenuError>());
488 489
489 // It's probably excessive to test every level of the overflow here. Test 490 // It's probably excessive to test every level of the overflow here. Test
490 // having all actions overflowed, some actions overflowed, and one action 491 // having all actions overflowed, some actions overflowed, and one action
491 // overflowed. 492 // overflowed.
492 resizeAndActivateAppMenu(kNumExtensions, "GlobalError Full"); 493 resizeAndActivateAppMenu(kNumExtensions, "GlobalError Full");
493 resizeAndActivateAppMenu(kNumExtensions / 2, "GlobalError Half"); 494 resizeAndActivateAppMenu(kNumExtensions / 2, "GlobalError Half");
494 resizeAndActivateAppMenu(1, "GlobalError One"); 495 resizeAndActivateAppMenu(1, "GlobalError One");
495 } 496 }
496 497
497 void AddExtensionWithMenuOpen(ToolbarController* toolbarController, 498 void AddExtensionWithMenuOpen(ToolbarController* toolbarController,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 openAndCloseAppMenu(appMenuController()); 643 openAndCloseAppMenu(appMenuController());
643 644
644 // Move the extension back to the main bar, so an overflow bar is no longer 645 // Move the extension back to the main bar, so an overflow bar is no longer
645 // needed. Then open and close the app menu a couple times. 646 // needed. Then open and close the app menu a couple times.
646 // This tests that the menu properly cleans up after itself when an overflow 647 // This tests that the menu properly cleans up after itself when an overflow
647 // was present, and is no longer (fix for crbug.com/603241). 648 // was present, and is no longer (fix for crbug.com/603241).
648 model()->SetVisibleIconCount(1); 649 model()->SetVisibleIconCount(1);
649 openAndCloseAppMenu(appMenuController()); 650 openAndCloseAppMenu(appMenuController());
650 openAndCloseAppMenu(appMenuController()); 651 openAndCloseAppMenu(appMenuController());
651 } 652 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_global_error.cc ('k') | chrome/browser/ui/global_error/global_error_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698