| 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 "chrome/browser/ui/location_bar/location_bar.h" | 5 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 protected: | 51 protected: |
| 52 void SetUpCommandLine(base::CommandLine* command_line) override; | 52 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 53 | 53 |
| 54 // 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. |
| 55 const extensions::Extension* LoadPageActionExtension( | 55 const extensions::Extension* LoadPageActionExtension( |
| 56 extensions::TestExtensionDir* dir); | 56 extensions::TestExtensionDir* dir); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> enable_override_; | 59 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> enable_override_; |
| 60 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> disable_redesign_; | 60 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> disable_redesign_; |
| 61 std::unique_ptr<extensions::FeatureSwitch::ScopedOverride> | |
| 62 disable_media_router_; | |
| 63 | 61 |
| 64 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTest); | 62 DISALLOW_COPY_AND_ASSIGN(LocationBarBrowserTest); |
| 65 }; | 63 }; |
| 66 | 64 |
| 67 void LocationBarBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { | 65 void LocationBarBrowserTest::SetUpCommandLine(base::CommandLine* command_line) { |
| 68 // 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 |
| 69 // enable the switch. | 67 // enable the switch. |
| 70 enable_override_.reset(new extensions::FeatureSwitch::ScopedOverride( | 68 enable_override_.reset(new extensions::FeatureSwitch::ScopedOverride( |
| 71 extensions::FeatureSwitch::enable_override_bookmarks_ui(), true)); | 69 extensions::FeatureSwitch::enable_override_bookmarks_ui(), true)); |
| 72 // We need to disable Media Router since having Media Router enabled will | |
| 73 // result in auto-enabling the redesign and breaking the test. | |
| 74 disable_media_router_.reset(new extensions::FeatureSwitch::ScopedOverride( | |
| 75 extensions::FeatureSwitch::media_router(), false)); | |
| 76 // 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 |
| 77 // *not* have the redesign turned on. | 71 // *not* have the redesign turned on. |
| 78 disable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride( | 72 disable_redesign_.reset(new extensions::FeatureSwitch::ScopedOverride( |
| 79 extensions::FeatureSwitch::extension_action_redesign(), false)); | 73 extensions::FeatureSwitch::extension_action_redesign(), false)); |
| 80 ExtensionBrowserTest::SetUpCommandLine(command_line); | 74 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 81 } | 75 } |
| 82 | 76 |
| 83 const extensions::Extension* LocationBarBrowserTest::LoadPageActionExtension( | 77 const extensions::Extension* LocationBarBrowserTest::LoadPageActionExtension( |
| 84 extensions::TestExtensionDir* dir) { | 78 extensions::TestExtensionDir* dir) { |
| 85 DCHECK(dir); | 79 DCHECK(dir); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 browser()->tab_strip_model()->GetActiveWebContents(); | 214 browser()->tab_strip_model()->GetActiveWebContents(); |
| 221 int tab_id = SessionTabHelper::IdForTab(tab); | 215 int tab_id = SessionTabHelper::IdForTab(tab); |
| 222 action->SetIsVisible(tab_id, true); | 216 action->SetIsVisible(tab_id, true); |
| 223 extensions::ExtensionActionAPI::Get(profile())->NotifyChange( | 217 extensions::ExtensionActionAPI::Get(profile())->NotifyChange( |
| 224 action, tab, profile()); | 218 action, tab, profile()); |
| 225 | 219 |
| 226 // We should still have no page actions. | 220 // We should still have no page actions. |
| 227 EXPECT_EQ(0, location_bar->PageActionCount()); | 221 EXPECT_EQ(0, location_bar->PageActionCount()); |
| 228 EXPECT_EQ(0, location_bar->PageActionVisibleCount()); | 222 EXPECT_EQ(0, location_bar->PageActionVisibleCount()); |
| 229 } | 223 } |
| OLD | NEW |