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

Side by Side Diff: chrome/browser/ui/location_bar/location_bar_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
« no previous file with comments | « chrome/browser/ui/libgtk2ui/unity_service.cc ('k') | chrome/browser/ui/login/login_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/ui/location_bar/location_bar.h"
6
7 #include <memory>
8
5 #include "base/macros.h" 9 #include "base/macros.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "base/run_loop.h" 10 #include "base/run_loop.h"
8 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" 12 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
10 #include "chrome/browser/extensions/extension_action.h" 13 #include "chrome/browser/extensions/extension_action.h"
11 #include "chrome/browser/extensions/extension_action_manager.h" 14 #include "chrome/browser/extensions/extension_action_manager.h"
12 #include "chrome/browser/extensions/extension_browsertest.h" 15 #include "chrome/browser/extensions/extension_browsertest.h"
13 #include "chrome/browser/extensions/extension_service.h" 16 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/test_extension_dir.h" 17 #include "chrome/browser/extensions/test_extension_dir.h"
15 #include "chrome/browser/sessions/session_tab_helper.h" 18 #include "chrome/browser/sessions/session_tab_helper.h"
16 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/location_bar/location_bar.h"
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
20 #include "extensions/common/extension.h" 22 #include "extensions/common/extension.h"
21 #include "extensions/common/extension_builder.h" 23 #include "extensions/common/extension_builder.h"
22 #include "extensions/common/feature_switch.h" 24 #include "extensions/common/feature_switch.h"
23 #include "extensions/common/value_builder.h" 25 #include "extensions/common/value_builder.h"
24 #include "extensions/test/extension_test_message_listener.h" 26 #include "extensions/test/extension_test_message_listener.h"
25 27
26 namespace { 28 namespace {
27 29
28 const char kBackgroundScriptSource[] = 30 const char kBackgroundScriptSource[] =
(...skipping 18 matching lines...) Expand all
47 ~LocationBarBrowserTest() override {} 49 ~LocationBarBrowserTest() override {}
48 50
49 protected: 51 protected:
50 void SetUpCommandLine(base::CommandLine* command_line) override; 52 void SetUpCommandLine(base::CommandLine* command_line) override;
51 53
52 // Load an extension with a PageAction that sends a message when clicked. 54 // Load an extension with a PageAction that sends a message when clicked.
53 const extensions::Extension* LoadPageActionExtension( 55 const extensions::Extension* LoadPageActionExtension(
54 extensions::TestExtensionDir* dir); 56 extensions::TestExtensionDir* dir);
55 57
56 private: 58 private:
57 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> enable_override_; 59 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> enable_override_;
58 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> enable_redesign_; 60 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> enable_redesign_;
59 61
60 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTest); 62 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTest);
61 }; 63 };
62 64
63 void LocationBarBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { 65 void LocationBarBrowserTest::SetUpCommandLine(base::CommandLine* command_line) {
64 // In order to let a vanilla extension override the bookmark star, we have to 66 // In order to let a vanilla extension override the bookmark star, we have to
65 // enable the switch. 67 // enable the switch.
66 enable_override_.reset(new extensions::FeatureSwitch::ScopedOverride( 68 enable_override_.reset(new extensions::FeatureSwitch::ScopedOverride(
67 extensions::FeatureSwitch::enable_override_bookmarks_ui(), true)); 69 extensions::FeatureSwitch::enable_override_bookmarks_ui(), true));
68 // For testing page actions in the location bar, we also have to be sure to 70 // For testing page actions in the location bar, we also have to be sure to
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 169 }
168 170
169 class LocationBarBrowserTestWithRedesign : public LocationBarBrowserTest { 171 class LocationBarBrowserTestWithRedesign : public LocationBarBrowserTest {
170 public: 172 public:
171 LocationBarBrowserTestWithRedesign() {} 173 LocationBarBrowserTestWithRedesign() {}
172 ~LocationBarBrowserTestWithRedesign() override {} 174 ~LocationBarBrowserTestWithRedesign() override {}
173 175
174 private: 176 private:
175 void SetUpCommandLine(base::CommandLine* command_line) override; 177 void SetUpCommandLine(base::CommandLine* command_line) override;
176 178
177 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> enable_redesign_; 179 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> enable_redesign_;
178 180
179 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTestWithRedesign); 181 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTestWithRedesign);
180 }; 182 };
181 183
182 void LocationBarBrowserTestWithRedesign::SetUpCommandLine( 184 void LocationBarBrowserTestWithRedesign::SetUpCommandLine(
183 base::CommandLine* command_line) { 185 base::CommandLine* command_line) {
184 LocationBarBrowserTest::SetUpCommandLine(command_line); 186 LocationBarBrowserTest::SetUpCommandLine(command_line);
185 enable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride( 187 enable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride(
186 extensions::FeatureSwitch::extension_action_redesign(), true)); 188 extensions::FeatureSwitch::extension_action_redesign(), true));
187 } 189 }
(...skipping 24 matching lines...) Expand all
212 browser()->tab_strip_model()->GetActiveWebContents(); 214 browser()->tab_strip_model()->GetActiveWebContents();
213 int tab_id = SessionTabHelper::IdForTab(tab); 215 int tab_id = SessionTabHelper::IdForTab(tab);
214 action->SetIsVisible(tab_id, true); 216 action->SetIsVisible(tab_id, true);
215 extensions::ExtensionActionAPI::Get(profile())->NotifyChange( 217 extensions::ExtensionActionAPI::Get(profile())->NotifyChange(
216 action, tab, profile()); 218 action, tab, profile());
217 219
218 // We should still have no page actions. 220 // We should still have no page actions.
219 EXPECT_EQ(0, location_bar->PageActionCount()); 221 EXPECT_EQ(0, location_bar->PageActionCount());
220 EXPECT_EQ(0, location_bar->PageActionVisibleCount()); 222 EXPECT_EQ(0, location_bar->PageActionVisibleCount());
221 } 223 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/unity_service.cc ('k') | chrome/browser/ui/login/login_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698