OLD | NEW |
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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.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/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
10 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 "}"; | 39 "}"; |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 class LocationBarBrowserTest : public ExtensionBrowserTest { | 43 class LocationBarBrowserTest : public ExtensionBrowserTest { |
44 public: | 44 public: |
45 LocationBarBrowserTest() {} | 45 LocationBarBrowserTest() {} |
46 virtual ~LocationBarBrowserTest() {} | 46 virtual ~LocationBarBrowserTest() {} |
47 | 47 |
48 protected: | 48 protected: |
49 virtual void SetUpCommandLine(base::CommandLine* command_line) override; | 49 void SetUpCommandLine(base::CommandLine* command_line) override; |
50 | 50 |
51 // Load an extension with a PageAction that sends a message when clicked. | 51 // Load an extension with a PageAction that sends a message when clicked. |
52 const extensions::Extension* LoadPageActionExtension( | 52 const extensions::Extension* LoadPageActionExtension( |
53 extensions::TestExtensionDir* dir); | 53 extensions::TestExtensionDir* dir); |
54 | 54 |
55 private: | 55 private: |
56 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> enable_override_; | 56 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> enable_override_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTest); | 58 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTest); |
59 }; | 59 }; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // The star should now be hidden. | 163 // The star should now be hidden. |
164 EXPECT_FALSE(location_bar->GetBookmarkStarVisibility()); | 164 EXPECT_FALSE(location_bar->GetBookmarkStarVisibility()); |
165 } | 165 } |
166 | 166 |
167 class LocationBarBrowserTestWithRedesign : public LocationBarBrowserTest { | 167 class LocationBarBrowserTestWithRedesign : public LocationBarBrowserTest { |
168 public: | 168 public: |
169 LocationBarBrowserTestWithRedesign() {} | 169 LocationBarBrowserTestWithRedesign() {} |
170 virtual ~LocationBarBrowserTestWithRedesign() {} | 170 virtual ~LocationBarBrowserTestWithRedesign() {} |
171 | 171 |
172 private: | 172 private: |
173 virtual void SetUpCommandLine(base::CommandLine* command_line) override; | 173 void SetUpCommandLine(base::CommandLine* command_line) override; |
174 | 174 |
175 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> enable_redesign_; | 175 scoped_ptr<extensions::FeatureSwitch::ScopedOverride> enable_redesign_; |
176 | 176 |
177 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTestWithRedesign); | 177 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTestWithRedesign); |
178 }; | 178 }; |
179 | 179 |
180 void LocationBarBrowserTestWithRedesign::SetUpCommandLine( | 180 void LocationBarBrowserTestWithRedesign::SetUpCommandLine( |
181 base::CommandLine* command_line) { | 181 base::CommandLine* command_line) { |
182 LocationBarBrowserTest::SetUpCommandLine(command_line); | 182 LocationBarBrowserTest::SetUpCommandLine(command_line); |
183 enable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride( | 183 enable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride( |
(...skipping 26 matching lines...) Expand all Loading... |
210 browser()->tab_strip_model()->GetActiveWebContents(); | 210 browser()->tab_strip_model()->GetActiveWebContents(); |
211 int tab_id = SessionTabHelper::IdForTab(tab); | 211 int tab_id = SessionTabHelper::IdForTab(tab); |
212 action->SetIsVisible(tab_id, true); | 212 action->SetIsVisible(tab_id, true); |
213 extensions::ExtensionActionAPI::Get(profile())->NotifyChange( | 213 extensions::ExtensionActionAPI::Get(profile())->NotifyChange( |
214 action, tab, profile()); | 214 action, tab, profile()); |
215 | 215 |
216 // We should still have no page actions. | 216 // We should still have no page actions. |
217 EXPECT_EQ(0, location_bar->PageActionCount()); | 217 EXPECT_EQ(0, location_bar->PageActionCount()); |
218 EXPECT_EQ(0, location_bar->PageActionVisibleCount()); | 218 EXPECT_EQ(0, location_bar->PageActionVisibleCount()); |
219 } | 219 } |
OLD | NEW |