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

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

Issue 11365181: Remove GetExtensionService from Profile. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: replace missing extension_system include Created 8 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 #include "chrome/browser/extensions/extension_service.h" 6 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/extension_system.h"
7 #include "chrome/browser/extensions/extension_toolbar_model.h" 8 #include "chrome/browser/extensions/extension_toolbar_model.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
10 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
11 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
12 13
13 using extensions::Extension; 14 using extensions::Extension;
14 15
15 // An InProcessBrowserTest for testing the ExtensionToolbarModel. 16 // An InProcessBrowserTest for testing the ExtensionToolbarModel.
16 // TODO(erikkay) It's unfortunate that this needs to be an in-proc browser test. 17 // TODO(erikkay) It's unfortunate that this needs to be an in-proc browser test.
17 // It would be nice to refactor things so that ExtensionService could run 18 // It would be nice to refactor things so that ExtensionService could run
18 // without so much of the browser in place. 19 // without so much of the browser in place.
19 class ExtensionToolbarModelTest : public ExtensionBrowserTest, 20 class ExtensionToolbarModelTest : public ExtensionBrowserTest,
20 public ExtensionToolbarModel::Observer { 21 public ExtensionToolbarModel::Observer {
21 public: 22 public:
22 virtual void SetUp() { 23 virtual void SetUp() {
23 inserted_count_ = 0; 24 inserted_count_ = 0;
24 removed_count_ = 0; 25 removed_count_ = 0;
25 moved_count_ = 0; 26 moved_count_ = 0;
26 27
27 ExtensionBrowserTest::SetUp(); 28 ExtensionBrowserTest::SetUp();
28 } 29 }
29 30
30 virtual void SetUpOnMainThread() OVERRIDE { 31 virtual void SetUpOnMainThread() OVERRIDE {
31 ExtensionService* service = browser()->profile()->GetExtensionService(); 32 ExtensionService* service = extensions::ExtensionSystem::Get(
33 browser()->profile())->extension_service();
32 model_ = service->toolbar_model(); 34 model_ = service->toolbar_model();
33 model_->AddObserver(this); 35 model_->AddObserver(this);
34 } 36 }
35 37
36 virtual void CleanUpOnMainThread() { 38 virtual void CleanUpOnMainThread() {
37 model_->RemoveObserver(this); 39 model_->RemoveObserver(this);
38 } 40 }
39 41
40 virtual void BrowserActionAdded(const Extension* extension, int index) { 42 virtual void BrowserActionAdded(const Extension* extension, int index) {
41 inserted_count_++; 43 inserted_count_++;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 225
224 // Load extension C again. 226 // Load extension C again.
225 ASSERT_TRUE(LoadExtension(extension_c_path)); 227 ASSERT_TRUE(LoadExtension(extension_c_path));
226 228
227 // Extension C loaded again. 229 // Extension C loaded again.
228 EXPECT_EQ(5, inserted_count_); 230 EXPECT_EQ(5, inserted_count_);
229 EXPECT_EQ(2u, model_->toolbar_items().size()); 231 EXPECT_EQ(2u, model_->toolbar_items().size());
230 // Make sure it gets its old spot in the list (at the very end). 232 // Make sure it gets its old spot in the list (at the very end).
231 ASSERT_STREQ(idC.c_str(), ExtensionAt(1)->id().c_str()); 233 ASSERT_STREQ(idC.c_str(), ExtensionAt(1)->id().c_str());
232 } 234 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_startup_browsertest.cc ('k') | chrome/browser/extensions/navigation_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698