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

Side by Side Diff: chrome/browser/extensions/active_tab_apitest.cc

Issue 48853005: Remove ExtensionToolbarModel from ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile after rebase Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/extension_action/browser_action_apitest.cc » ('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 (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/logging.h" 5 #include "base/logging.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_toolbar_model.h"
8 #include "chrome/browser/extensions/extension_system.h"
9 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
10 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
11 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
12 #include "net/test/embedded_test_server/embedded_test_server.h" 11 #include "net/test/embedded_test_server/embedded_test_server.h"
13 12
14 namespace extensions { 13 namespace extensions {
15 namespace { 14 namespace {
16 15
17 // Times out on win asan, http://crbug.com/166026 16 // Times out on win asan, http://crbug.com/166026
18 #if defined(OS_WIN) && defined(ADDRESS_SANITIZER) 17 #if defined(OS_WIN) && defined(ADDRESS_SANITIZER)
19 #define MAYBE_ActiveTab DISABLED_ActiveTab 18 #define MAYBE_ActiveTab DISABLED_ActiveTab
20 #else 19 #else
21 #define MAYBE_ActiveTab ActiveTab 20 #define MAYBE_ActiveTab ActiveTab
22 #endif 21 #endif
23 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ActiveTab) { 22 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_ActiveTab) {
24 ASSERT_TRUE(StartEmbeddedTestServer()); 23 ASSERT_TRUE(StartEmbeddedTestServer());
25 24
26 const Extension* extension = 25 const Extension* extension =
27 LoadExtension(test_data_dir_.AppendASCII("active_tab")); 26 LoadExtension(test_data_dir_.AppendASCII("active_tab"));
28 ASSERT_TRUE(extension); 27 ASSERT_TRUE(extension);
29 28
30 ExtensionService* service = 29 ExtensionToolbarModel* toolbar_model =
31 ExtensionSystem::Get(browser()->profile())->extension_service(); 30 ExtensionToolbarModel::Get(browser()->profile());
32 31
33 // Shouldn't be initially granted based on activeTab. 32 // Shouldn't be initially granted based on activeTab.
34 { 33 {
35 ResultCatcher catcher; 34 ResultCatcher catcher;
36 ui_test_utils::NavigateToURL( 35 ui_test_utils::NavigateToURL(
37 browser(), 36 browser(),
38 embedded_test_server()->GetURL( 37 embedded_test_server()->GetURL(
39 "/extensions/api_test/active_tab/page.html")); 38 "/extensions/api_test/active_tab/page.html"));
40 EXPECT_TRUE(catcher.GetNextResult()) << message_; 39 EXPECT_TRUE(catcher.GetNextResult()) << message_;
41 } 40 }
42 41
43 // Granting to the extension should give it access to page.html. 42 // Granting to the extension should give it access to page.html.
44 { 43 {
45 ResultCatcher catcher; 44 ResultCatcher catcher;
46 service->toolbar_model()->ExecuteBrowserAction( 45 toolbar_model->ExecuteBrowserAction(extension, browser(), NULL, true);
47 extension, browser(), NULL, true);
48 EXPECT_TRUE(catcher.GetNextResult()) << message_; 46 EXPECT_TRUE(catcher.GetNextResult()) << message_;
49 } 47 }
50 48
51 // Changing page should go back to it not having access. 49 // Changing page should go back to it not having access.
52 { 50 {
53 ResultCatcher catcher; 51 ResultCatcher catcher;
54 ui_test_utils::NavigateToURL( 52 ui_test_utils::NavigateToURL(
55 browser(), 53 browser(),
56 embedded_test_server()->GetURL( 54 embedded_test_server()->GetURL(
57 "/extensions/api_test/active_tab/final_page.html")); 55 "/extensions/api_test/active_tab/final_page.html"));
58 EXPECT_TRUE(catcher.GetNextResult()) << message_; 56 EXPECT_TRUE(catcher.GetNextResult()) << message_;
59 } 57 }
60 } 58 }
61 59
62 } // namespace 60 } // namespace
63 } // namespace extensions 61 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/extension_action/browser_action_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698