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

Side by Side Diff: chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc

Issue 14699002: Move BrowserAction references from ExtensionPrefs to ExtensionActionAPI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
6 #include "chrome/browser/extensions/browser_action_test_util.h" 7 #include "chrome/browser/extensions/browser_action_test_util.h"
7 #include "chrome/browser/extensions/extension_action.h" 8 #include "chrome/browser/extensions/extension_action.h"
8 #include "chrome/browser/extensions/extension_action_icon_factory.h" 9 #include "chrome/browser/extensions/extension_action_icon_factory.h"
9 #include "chrome/browser/extensions/extension_action_manager.h" 10 #include "chrome/browser/extensions/extension_action_manager.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 11 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/extensions/extension_prefs.h" 12 #include "chrome/browser/extensions/extension_prefs.h"
12 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/extension_system.h" 14 #include "chrome/browser/extensions/extension_system.h"
14 #include "chrome/browser/extensions/extension_tab_util.h" 15 #include "chrome/browser/extensions/extension_tab_util.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ASSERT_TRUE(RunExtensionTest("page_action/basics")) << message_; 54 ASSERT_TRUE(RunExtensionTest("page_action/basics")) << message_;
54 const Extension* extension = GetSingleLoadedExtension(); 55 const Extension* extension = GetSingleLoadedExtension();
55 ASSERT_TRUE(extension) << message_; 56 ASSERT_TRUE(extension) << message_;
56 57
57 // The extension declares a page action, but it should have gotten a browser 58 // The extension declares a page action, but it should have gotten a browser
58 // action instead. 59 // action instead.
59 ASSERT_TRUE(extension_action_manager()->GetBrowserAction(*extension)); 60 ASSERT_TRUE(extension_action_manager()->GetBrowserAction(*extension));
60 ASSERT_FALSE(extension_action_manager()->GetPageAction(*extension)); 61 ASSERT_FALSE(extension_action_manager()->GetPageAction(*extension));
61 62
62 // With the "action box" there won't be browser actions unless they're pinned. 63 // With the "action box" there won't be browser actions unless they're pinned.
63 ExtensionPrefs* prefs = extensions::ExtensionSystem::Get( 64 ExtensionActionAPI::SetBrowserActionVisibility(
64 browser()->profile())->extension_service()->extension_prefs(); 65 extensions::ExtensionSystem::Get(browser()->profile())->
65 prefs->SetBrowserActionVisibility(extension, true); 66 extension_service()->extension_prefs(),
67 extension->id(),
68 true);
66 69
67 // Test that there is a browser action in the toolbar. 70 // Test that there is a browser action in the toolbar.
68 ASSERT_EQ(1, GetBrowserActionsBar().NumberOfBrowserActions()); 71 ASSERT_EQ(1, GetBrowserActionsBar().NumberOfBrowserActions());
69 72
70 { 73 {
71 // Tell the extension to update the page action state. 74 // Tell the extension to update the page action state.
72 ResultCatcher catcher; 75 ResultCatcher catcher;
73 ui_test_utils::NavigateToURL(browser(), 76 ui_test_utils::NavigateToURL(browser(),
74 GURL(extension->GetResourceURL("update.html"))); 77 GURL(extension->GetResourceURL("update.html")));
75 ASSERT_TRUE(catcher.GetNextResult()); 78 ASSERT_TRUE(catcher.GetNextResult());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 ASSERT_TRUE(extension) << message_; 197 ASSERT_TRUE(extension) << message_;
195 198
196 ResultCatcher catcher; 199 ResultCatcher catcher;
197 ui_test_utils::NavigateToURL(browser(), 200 ui_test_utils::NavigateToURL(browser(),
198 GURL(extension->GetResourceURL("update.html"))); 201 GURL(extension->GetResourceURL("update.html")));
199 ASSERT_TRUE(catcher.GetNextResult()); 202 ASSERT_TRUE(catcher.GetNextResult());
200 } 203 }
201 204
202 } 205 }
203 } // namespace extensions 206 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698