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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 const extensions::Extension* LocationBarBrowserTest::LoadPageActionExtension( | 83 const extensions::Extension* LocationBarBrowserTest::LoadPageActionExtension( |
84 extensions::TestExtensionDir* dir) { | 84 extensions::TestExtensionDir* dir) { |
85 DCHECK(dir); | 85 DCHECK(dir); |
86 | 86 |
87 dir->WriteManifest(base::StringPrintf(kManifestSource, "page_action1")); | 87 dir->WriteManifest(base::StringPrintf(kManifestSource, "page_action1")); |
88 dir->WriteFile(FILE_PATH_LITERAL("background.js"), kBackgroundScriptSource); | 88 dir->WriteFile(FILE_PATH_LITERAL("background.js"), kBackgroundScriptSource); |
89 | 89 |
90 ExtensionTestMessageListener registered_listener("registered", false); | 90 ExtensionTestMessageListener registered_listener("registered", false); |
91 const extensions::Extension* extension = LoadExtension(dir->unpacked_path()); | 91 const extensions::Extension* extension = LoadExtension(dir->UnpackedPath()); |
92 registered_listener.WaitUntilSatisfied(); | 92 registered_listener.WaitUntilSatisfied(); |
93 | 93 |
94 return extension; | 94 return extension; |
95 } | 95 } |
96 | 96 |
97 // Test that page actions show up properly in the location bar. Since the | 97 // Test that page actions show up properly in the location bar. Since the |
98 // page action logic is more fully tested as part of the extensions system, this | 98 // page action logic is more fully tested as part of the extensions system, this |
99 // only needs to check that they are displayed and clicking on them triggers | 99 // only needs to check that they are displayed and clicking on them triggers |
100 // the action. | 100 // the action. |
101 IN_PROC_BROWSER_TEST_F(LocationBarBrowserTest, PageActionUITest) { | 101 IN_PROC_BROWSER_TEST_F(LocationBarBrowserTest, PageActionUITest) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 browser()->tab_strip_model()->GetActiveWebContents(); | 220 browser()->tab_strip_model()->GetActiveWebContents(); |
221 int tab_id = SessionTabHelper::IdForTab(tab); | 221 int tab_id = SessionTabHelper::IdForTab(tab); |
222 action->SetIsVisible(tab_id, true); | 222 action->SetIsVisible(tab_id, true); |
223 extensions::ExtensionActionAPI::Get(profile())->NotifyChange( | 223 extensions::ExtensionActionAPI::Get(profile())->NotifyChange( |
224 action, tab, profile()); | 224 action, tab, profile()); |
225 | 225 |
226 // We should still have no page actions. | 226 // We should still have no page actions. |
227 EXPECT_EQ(0, location_bar->PageActionCount()); | 227 EXPECT_EQ(0, location_bar->PageActionCount()); |
228 EXPECT_EQ(0, location_bar->PageActionVisibleCount()); | 228 EXPECT_EQ(0, location_bar->PageActionVisibleCount()); |
229 } | 229 } |
OLD | NEW |