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

Side by Side Diff: chrome/browser/ui/toolbar/component_toolbar_actions_browsertest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 <memory>
6
5 #include "base/macros.h" 7 #include "base/macros.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "chrome/browser/extensions/browser_action_test_util.h" 8 #include "chrome/browser/extensions/browser_action_test_util.h"
8 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" 10 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h"
10 #include "chrome/browser/ui/toolbar/mock_component_toolbar_actions_factory.h" 11 #include "chrome/browser/ui/toolbar/mock_component_toolbar_actions_factory.h"
11 #include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.h" 12 #include "chrome/browser/ui/toolbar/test_toolbar_action_view_controller.h"
12 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" 13 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
13 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" 14 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
14 #include "chrome/test/base/in_process_browser_test.h" 15 #include "chrome/test/base/in_process_browser_test.h"
15 #include "extensions/common/feature_switch.h" 16 #include "extensions/common/feature_switch.h"
16 17
17 class ComponentToolbarActionsBrowserTest : public InProcessBrowserTest { 18 class ComponentToolbarActionsBrowserTest : public InProcessBrowserTest {
18 protected: 19 protected:
19 ComponentToolbarActionsBrowserTest() {} 20 ComponentToolbarActionsBrowserTest() {}
20 ~ComponentToolbarActionsBrowserTest() override {} 21 ~ComponentToolbarActionsBrowserTest() override {}
21 22
22 void SetUpCommandLine(base::CommandLine* command_line) override { 23 void SetUpCommandLine(base::CommandLine* command_line) override {
23 InProcessBrowserTest::SetUpCommandLine(command_line); 24 InProcessBrowserTest::SetUpCommandLine(command_line);
24 enable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride( 25 enable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride(
25 extensions::FeatureSwitch::extension_action_redesign(), true)); 26 extensions::FeatureSwitch::extension_action_redesign(), true));
26 mock_actions_factory_.reset(new MockComponentToolbarActionsFactory( 27 mock_actions_factory_.reset(new MockComponentToolbarActionsFactory(
27 browser())); 28 browser()));
28 } 29 }
29 30
30 MockComponentToolbarActionsFactory* mock_factory() { 31 MockComponentToolbarActionsFactory* mock_factory() {
31 return mock_actions_factory_.get(); 32 return mock_actions_factory_.get();
32 } 33 }
33 34
34 private: 35 private:
35 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> enable_redesign_; 36 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> enable_redesign_;
36 scoped_ptr<MockComponentToolbarActionsFactory> mock_actions_factory_; 37 std::unique_ptr<MockComponentToolbarActionsFactory> mock_actions_factory_;
37 38
38 DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsBrowserTest); 39 DISALLOW_COPY_AND_ASSIGN(ComponentToolbarActionsBrowserTest);
39 }; 40 };
40 41
41 // Test that Component Toolbar Actions appear in the browser actions container 42 // Test that Component Toolbar Actions appear in the browser actions container
42 // and can receive click events properly. 43 // and can receive click events properly.
43 IN_PROC_BROWSER_TEST_F(ComponentToolbarActionsBrowserTest, 44 IN_PROC_BROWSER_TEST_F(ComponentToolbarActionsBrowserTest,
44 ComponentToolbarActionsShowUpAndRespondToClicks) { 45 ComponentToolbarActionsShowUpAndRespondToClicks) {
45 BrowserActionTestUtil browser_actions_bar(browser()); 46 BrowserActionTestUtil browser_actions_bar(browser());
46 47
(...skipping 14 matching lines...) Expand all
61 browser_actions_bar.GetToolbarActionsBar()->GetActions(); 62 browser_actions_bar.GetToolbarActionsBar()->GetActions();
62 TestToolbarActionViewController* mock_component_action = 63 TestToolbarActionViewController* mock_component_action =
63 static_cast<TestToolbarActionViewController* const>(actions[0]); 64 static_cast<TestToolbarActionViewController* const>(actions[0]);
64 ASSERT_TRUE(mock_component_action); 65 ASSERT_TRUE(mock_component_action);
65 66
66 // Test that clicking on the component action works. 67 // Test that clicking on the component action works.
67 EXPECT_EQ(0, mock_component_action->execute_action_count()); 68 EXPECT_EQ(0, mock_component_action->execute_action_count());
68 browser_actions_bar.Press(0); 69 browser_actions_bar.Press(0);
69 EXPECT_EQ(1, mock_component_action->execute_action_count()); 70 EXPECT_EQ(1, mock_component_action->execute_action_count());
70 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698