| OLD | NEW |
| 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/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 8 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 9 #include "chrome/browser/extensions/browser_action_test_util.h" | 9 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 container->OnPerformDrop(target_event); | 173 container->OnPerformDrop(target_event); |
| 174 | 174 |
| 175 // The order should now be B A C, since A was dragged to the right of B. | 175 // The order should now be B A C, since A was dragged to the right of B. |
| 176 EXPECT_EQ(extension_b->id(), browser_actions_bar()->GetExtensionId(0)); | 176 EXPECT_EQ(extension_b->id(), browser_actions_bar()->GetExtensionId(0)); |
| 177 EXPECT_EQ(extension_a->id(), browser_actions_bar()->GetExtensionId(1)); | 177 EXPECT_EQ(extension_a->id(), browser_actions_bar()->GetExtensionId(1)); |
| 178 EXPECT_EQ(extension_c->id(), browser_actions_bar()->GetExtensionId(2)); | 178 EXPECT_EQ(extension_c->id(), browser_actions_bar()->GetExtensionId(2)); |
| 179 | 179 |
| 180 // This order should be reflected in the underlying model. | 180 // This order should be reflected in the underlying model. |
| 181 extensions::ExtensionToolbarModel* model = | 181 extensions::ExtensionToolbarModel* model = |
| 182 extensions::ExtensionToolbarModel::Get(profile()); | 182 extensions::ExtensionToolbarModel::Get(profile()); |
| 183 EXPECT_EQ(extension_b, model->toolbar_items()[0]); | 183 EXPECT_EQ(extension_b, model->toolbar_items()[0].get()); |
| 184 EXPECT_EQ(extension_a, model->toolbar_items()[1]); | 184 EXPECT_EQ(extension_a, model->toolbar_items()[1].get()); |
| 185 EXPECT_EQ(extension_c, model->toolbar_items()[2]); | 185 EXPECT_EQ(extension_c, model->toolbar_items()[2].get()); |
| 186 | 186 |
| 187 // Simulate a drag and drop to the left. | 187 // Simulate a drag and drop to the left. |
| 188 ui::OSExchangeData drop_data2; | 188 ui::OSExchangeData drop_data2; |
| 189 // Drag extension A from index 1... | 189 // Drag extension A from index 1... |
| 190 BrowserActionDragData browser_action_drag_data2(extension_a->id(), 1u); | 190 BrowserActionDragData browser_action_drag_data2(extension_a->id(), 1u); |
| 191 browser_action_drag_data2.Write(profile(), &drop_data2); | 191 browser_action_drag_data2.Write(profile(), &drop_data2); |
| 192 // ...to the left of extension B (which is now at index 0). | 192 // ...to the left of extension B (which is now at index 0). |
| 193 location = gfx::Point(view->x(), view->y()); | 193 location = gfx::Point(view->x(), view->y()); |
| 194 ui::DropTargetEvent target_event2( | 194 ui::DropTargetEvent target_event2( |
| 195 drop_data2, location, location, ui::DragDropTypes::DRAG_MOVE); | 195 drop_data2, location, location, ui::DragDropTypes::DRAG_MOVE); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 677 |
| 678 main_bar()->OnDragUpdated(target_event3); | 678 main_bar()->OnDragUpdated(target_event3); |
| 679 main_bar()->OnPerformDrop(target_event3); | 679 main_bar()->OnPerformDrop(target_event3); |
| 680 | 680 |
| 681 // Order should be A C B, and there should be no extensions in overflow. | 681 // Order should be A C B, and there should be no extensions in overflow. |
| 682 EXPECT_EQ(extension_a, main_bar()->GetBrowserActionViewAt(0)->extension()); | 682 EXPECT_EQ(extension_a, main_bar()->GetBrowserActionViewAt(0)->extension()); |
| 683 EXPECT_EQ(extension_c, main_bar()->GetBrowserActionViewAt(1)->extension()); | 683 EXPECT_EQ(extension_c, main_bar()->GetBrowserActionViewAt(1)->extension()); |
| 684 EXPECT_EQ(extension_b, main_bar()->GetBrowserActionViewAt(2)->extension()); | 684 EXPECT_EQ(extension_b, main_bar()->GetBrowserActionViewAt(2)->extension()); |
| 685 VerifyVisibleCount(3u); | 685 VerifyVisibleCount(3u); |
| 686 } | 686 } |
| OLD | NEW |