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

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_actions_container_browsertest.cc

Issue 675023002: Make extensions that desire to act pop out if in overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Peter's Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/views/toolbar/browser_actions_container.h" 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
6 6
7 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 7 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
8 #include "chrome/browser/extensions/browser_action_test_util.h" 8 #include "chrome/browser/extensions/browser_action_test_util.h"
9 #include "chrome/browser/extensions/extension_toolbar_model.h" 9 #include "chrome/browser/extensions/extension_toolbar_model.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 container->OnPerformDrop(target_event3); 109 container->OnPerformDrop(target_event3);
110 110
111 // The order should have changed *and* the container should have grown to 111 // The order should have changed *and* the container should have grown to
112 // accommodate extension C. The new order should be A C B, and all three 112 // accommodate extension C. The new order should be A C B, and all three
113 // extensions should be visible, with no overflow menu. 113 // extensions should be visible, with no overflow menu.
114 EXPECT_EQ(extension_a()->id(), browser_actions_bar()->GetExtensionId(0)); 114 EXPECT_EQ(extension_a()->id(), browser_actions_bar()->GetExtensionId(0));
115 EXPECT_EQ(extension_c()->id(), browser_actions_bar()->GetExtensionId(1)); 115 EXPECT_EQ(extension_c()->id(), browser_actions_bar()->GetExtensionId(1));
116 EXPECT_EQ(extension_b()->id(), browser_actions_bar()->GetExtensionId(2)); 116 EXPECT_EQ(extension_b()->id(), browser_actions_bar()->GetExtensionId(2));
117 EXPECT_EQ(3u, container->VisibleBrowserActions()); 117 EXPECT_EQ(3u, container->VisibleBrowserActions());
118 EXPECT_FALSE(container->chevron()->visible()); 118 EXPECT_FALSE(container->chevron()->visible());
119 EXPECT_EQ(-1, model->GetVisibleIconCount()); 119 EXPECT_TRUE(model->all_icons_visible());
120 120
121 // TODO(devlin): Ideally, we'd also have tests for dragging from the legacy 121 // TODO(devlin): Ideally, we'd also have tests for dragging from the legacy
122 // overflow menu (i.e., chevron) to the main bar, but this requires either 122 // overflow menu (i.e., chevron) to the main bar, but this requires either
123 // having a fairly complicated interactive UI test or finding a good way to 123 // having a fairly complicated interactive UI test or finding a good way to
124 // mock up the BrowserActionOverflowMenuController. 124 // mock up the BrowserActionOverflowMenuController.
125 } 125 }
126 126
127 IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, Visibility) { 127 IN_PROC_BROWSER_TEST_F(BrowserActionsBarBrowserTest, Visibility) {
128 LoadExtensions(); 128 LoadExtensions();
129 129
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 IN_PROC_BROWSER_TEST_F(BrowserActionsContainerOverflowTest, 431 IN_PROC_BROWSER_TEST_F(BrowserActionsContainerOverflowTest,
432 TestBasicActionOverflow) { 432 TestBasicActionOverflow) {
433 LoadExtensions(); 433 LoadExtensions();
434 434
435 // Since the overflow bar isn't attached to a view, we have to kick it in 435 // Since the overflow bar isn't attached to a view, we have to kick it in
436 // order to retrigger layout each time we change the number of icons in the 436 // order to retrigger layout each time we change the number of icons in the
437 // bar. 437 // bar.
438 overflow_bar()->Layout(); 438 overflow_bar()->Layout();
439 439
440 // All actions are showing, and are in the installation order. 440 // All actions are showing, and are in the installation order.
441 EXPECT_EQ(-1, model()->GetVisibleIconCount()); 441 EXPECT_TRUE(model()->all_icons_visible());
442 EXPECT_EQ(3u, model()->visible_icon_count());
442 ASSERT_EQ(3u, main_bar()->num_browser_actions()); 443 ASSERT_EQ(3u, main_bar()->num_browser_actions());
443 EXPECT_EQ(extension_a()->id(), main_bar()->GetIdAt(0u)); 444 EXPECT_EQ(extension_a()->id(), main_bar()->GetIdAt(0u));
444 EXPECT_EQ(extension_b()->id(), main_bar()->GetIdAt(1u)); 445 EXPECT_EQ(extension_b()->id(), main_bar()->GetIdAt(1u));
445 EXPECT_EQ(extension_c()->id(), main_bar()->GetIdAt(2u)); 446 EXPECT_EQ(extension_c()->id(), main_bar()->GetIdAt(2u));
446 EXPECT_TRUE(VerifyVisibleCount(3u)); 447 EXPECT_TRUE(VerifyVisibleCount(3u));
447 448
448 // Reduce the visible count to 2. Order should be unchanged (A B C), but 449 // Reduce the visible count to 2. Order should be unchanged (A B C), but
449 // only A and B should be visible on the main bar. 450 // only A and B should be visible on the main bar.
450 model()->SetVisibleIconCount(2u); 451 model()->SetVisibleIconCount(2u);
451 overflow_bar()->Layout(); // Kick. 452 overflow_bar()->Layout(); // Kick.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 542
542 main_bar()->OnDragUpdated(target_event3); 543 main_bar()->OnDragUpdated(target_event3);
543 main_bar()->OnPerformDrop(target_event3); 544 main_bar()->OnPerformDrop(target_event3);
544 545
545 // Order should be A C B, and there should be no extensions in overflow. 546 // Order should be A C B, and there should be no extensions in overflow.
546 EXPECT_EQ(extension_a()->id(), main_bar()->GetIdAt(0u)); 547 EXPECT_EQ(extension_a()->id(), main_bar()->GetIdAt(0u));
547 EXPECT_EQ(extension_c()->id(), main_bar()->GetIdAt(1u)); 548 EXPECT_EQ(extension_c()->id(), main_bar()->GetIdAt(1u));
548 EXPECT_EQ(extension_b()->id(), main_bar()->GetIdAt(2u)); 549 EXPECT_EQ(extension_b()->id(), main_bar()->GetIdAt(2u));
549 VerifyVisibleCount(3u); 550 VerifyVisibleCount(3u);
550 } 551 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698