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

Side by Side Diff: chrome/browser/extensions/extension_toolbar_model_browsertest.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
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"
7 #include "chrome/browser/extensions/extension_system.h"
8 #include "chrome/browser/extensions/extension_toolbar_model.h" 6 #include "chrome/browser/extensions/extension_toolbar_model.h"
9 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
11 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
12 10
13 using extensions::Extension; 11 using extensions::Extension;
14 12
15 // An InProcessBrowserTest for testing the ExtensionToolbarModel. 13 // An InProcessBrowserTest for testing the ExtensionToolbarModel.
16 // TODO(erikkay) It's unfortunate that this needs to be an in-proc browser test. 14 // 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 15 // It would be nice to refactor things so that ExtensionService could run
18 // without so much of the browser in place. 16 // without so much of the browser in place.
19 class ExtensionToolbarModelTest : public ExtensionBrowserTest, 17 class ExtensionToolbarModelTest : public ExtensionBrowserTest,
20 public ExtensionToolbarModel::Observer { 18 public ExtensionToolbarModel::Observer {
21 public: 19 public:
22 virtual void SetUp() { 20 virtual void SetUp() {
23 inserted_count_ = 0; 21 inserted_count_ = 0;
24 removed_count_ = 0; 22 removed_count_ = 0;
25 moved_count_ = 0; 23 moved_count_ = 0;
26 24
27 ExtensionBrowserTest::SetUp(); 25 ExtensionBrowserTest::SetUp();
28 } 26 }
29 27
30 virtual void SetUpOnMainThread() OVERRIDE { 28 virtual void SetUpOnMainThread() OVERRIDE {
31 ExtensionService* service = extensions::ExtensionSystem::Get( 29 model_ = ExtensionToolbarModel::Get(browser()->profile());
32 browser()->profile())->extension_service();
33 model_ = service->toolbar_model();
34 model_->AddObserver(this); 30 model_->AddObserver(this);
35 } 31 }
36 32
37 virtual void CleanUpOnMainThread() OVERRIDE { 33 virtual void CleanUpOnMainThread() OVERRIDE {
38 model_->RemoveObserver(this); 34 model_->RemoveObserver(this);
39 } 35 }
40 36
41 virtual void BrowserActionAdded(const Extension* extension, 37 virtual void BrowserActionAdded(const Extension* extension,
42 int index) OVERRIDE { 38 int index) OVERRIDE {
43 inserted_count_++; 39 inserted_count_++;
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 new_order.push_back(id_c); 366 new_order.push_back(id_c);
371 new_order.push_back(id_b); 367 new_order.push_back(id_b);
372 extensions::ExtensionPrefs::Get(browser()->profile())->SetToolbarOrder( 368 extensions::ExtensionPrefs::Get(browser()->profile())->SetToolbarOrder(
373 new_order); 369 new_order);
374 370
375 // Verify order is changed. 371 // Verify order is changed.
376 EXPECT_EQ(id_c, ExtensionAt(0)->id()); 372 EXPECT_EQ(id_c, ExtensionAt(0)->id());
377 EXPECT_EQ(id_b, ExtensionAt(1)->id()); 373 EXPECT_EQ(id_b, ExtensionAt(1)->id());
378 EXPECT_EQ(id_a, ExtensionAt(2)->id()); 374 EXPECT_EQ(id_a, ExtensionAt(2)->id());
379 } 375 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_toolbar_model.cc ('k') | chrome/browser/extensions/extension_toolbar_model_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698