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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 class BrowserActionsContainerTest : public ExtensionBrowserTest { | 52 class BrowserActionsContainerTest : public ExtensionBrowserTest { |
53 public: | 53 public: |
54 BrowserActionsContainerTest() { | 54 BrowserActionsContainerTest() { |
55 } | 55 } |
56 virtual ~BrowserActionsContainerTest() {} | 56 virtual ~BrowserActionsContainerTest() {} |
57 | 57 |
58 protected: | 58 protected: |
59 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { | 59 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
60 BrowserActionsContainer::disable_animations_during_testing_ = true; | 60 BrowserActionsContainer::disable_animations_during_testing_ = true; |
61 ExtensionBrowserTest::SetUpCommandLine(command_line); | 61 ExtensionBrowserTest::SetUpCommandLine(command_line); |
62 } | 62 } |
63 | 63 |
64 virtual void SetUpOnMainThread() OVERRIDE { | 64 virtual void SetUpOnMainThread() override { |
65 ExtensionBrowserTest::SetUpOnMainThread(); | 65 ExtensionBrowserTest::SetUpOnMainThread(); |
66 browser_actions_bar_.reset(new BrowserActionTestUtil(browser())); | 66 browser_actions_bar_.reset(new BrowserActionTestUtil(browser())); |
67 } | 67 } |
68 | 68 |
69 virtual void TearDownOnMainThread() OVERRIDE { | 69 virtual void TearDownOnMainThread() override { |
70 BrowserActionsContainer::disable_animations_during_testing_ = false; | 70 BrowserActionsContainer::disable_animations_during_testing_ = false; |
71 ExtensionBrowserTest::TearDownOnMainThread(); | 71 ExtensionBrowserTest::TearDownOnMainThread(); |
72 } | 72 } |
73 | 73 |
74 BrowserActionTestUtil* browser_actions_bar() { | 74 BrowserActionTestUtil* browser_actions_bar() { |
75 return browser_actions_bar_.get(); | 75 return browser_actions_bar_.get(); |
76 } | 76 } |
77 | 77 |
78 // Creates three different extensions, each with a browser action, and adds | 78 // Creates three different extensions, each with a browser action, and adds |
79 // them to associated ExtensionService. These can then be accessed via | 79 // them to associated ExtensionService. These can then be accessed via |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 // |expected_visible| and shows the first icons, and that the overflow bar | 446 // |expected_visible| and shows the first icons, and that the overflow bar |
447 // shows all (and only) the remainder. | 447 // shows all (and only) the remainder. |
448 testing::AssertionResult VerifyVisibleCount(size_t expected_visible); | 448 testing::AssertionResult VerifyVisibleCount(size_t expected_visible); |
449 | 449 |
450 // Accessors. | 450 // Accessors. |
451 BrowserActionsContainer* main_bar() { return main_bar_; } | 451 BrowserActionsContainer* main_bar() { return main_bar_; } |
452 BrowserActionsContainer* overflow_bar() { return overflow_bar_.get(); } | 452 BrowserActionsContainer* overflow_bar() { return overflow_bar_.get(); } |
453 extensions::ExtensionToolbarModel* model() { return model_; } | 453 extensions::ExtensionToolbarModel* model() { return model_; } |
454 | 454 |
455 private: | 455 private: |
456 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; | 456 virtual void SetUpCommandLine(base::CommandLine* command_line) override; |
457 virtual void SetUpOnMainThread() OVERRIDE; | 457 virtual void SetUpOnMainThread() override; |
458 virtual void TearDownOnMainThread() OVERRIDE; | 458 virtual void TearDownOnMainThread() override; |
459 | 459 |
460 // The main BrowserActionsContainer (owned by the browser view). | 460 // The main BrowserActionsContainer (owned by the browser view). |
461 BrowserActionsContainer* main_bar_; | 461 BrowserActionsContainer* main_bar_; |
462 | 462 |
463 // The overflow BrowserActionsContainer. We manufacture this so that we don't | 463 // The overflow BrowserActionsContainer. We manufacture this so that we don't |
464 // have to open the wrench menu. | 464 // have to open the wrench menu. |
465 scoped_ptr<BrowserActionsContainer> overflow_bar_; | 465 scoped_ptr<BrowserActionsContainer> overflow_bar_; |
466 | 466 |
467 // The associated toolbar model. | 467 // The associated toolbar model. |
468 extensions::ExtensionToolbarModel* model_; | 468 extensions::ExtensionToolbarModel* model_; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 | 645 |
646 main_bar()->OnDragUpdated(target_event3); | 646 main_bar()->OnDragUpdated(target_event3); |
647 main_bar()->OnPerformDrop(target_event3); | 647 main_bar()->OnPerformDrop(target_event3); |
648 | 648 |
649 // Order should be A C B, and there should be no extensions in overflow. | 649 // Order should be A C B, and there should be no extensions in overflow. |
650 EXPECT_EQ(extension_a(), main_bar()->GetBrowserActionViewAt(0)->extension()); | 650 EXPECT_EQ(extension_a(), main_bar()->GetBrowserActionViewAt(0)->extension()); |
651 EXPECT_EQ(extension_c(), main_bar()->GetBrowserActionViewAt(1)->extension()); | 651 EXPECT_EQ(extension_c(), main_bar()->GetBrowserActionViewAt(1)->extension()); |
652 EXPECT_EQ(extension_b(), main_bar()->GetBrowserActionViewAt(2)->extension()); | 652 EXPECT_EQ(extension_b(), main_bar()->GetBrowserActionViewAt(2)->extension()); |
653 VerifyVisibleCount(3u); | 653 VerifyVisibleCount(3u); |
654 } | 654 } |
OLD | NEW |