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

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

Issue 12212047: Linux/ChromeOS Chromium style checker cleanup, chrome/browser/extensions edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 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 | 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" 6 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/extension_system.h" 7 #include "chrome/browser/extensions/extension_system.h"
8 #include "chrome/browser/extensions/extension_toolbar_model.h" 8 #include "chrome/browser/extensions/extension_toolbar_model.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 17 matching lines...) Expand all
28 ExtensionBrowserTest::SetUp(); 28 ExtensionBrowserTest::SetUp();
29 } 29 }
30 30
31 virtual void SetUpOnMainThread() OVERRIDE { 31 virtual void SetUpOnMainThread() OVERRIDE {
32 ExtensionService* service = extensions::ExtensionSystem::Get( 32 ExtensionService* service = extensions::ExtensionSystem::Get(
33 browser()->profile())->extension_service(); 33 browser()->profile())->extension_service();
34 model_ = service->toolbar_model(); 34 model_ = service->toolbar_model();
35 model_->AddObserver(this); 35 model_->AddObserver(this);
36 } 36 }
37 37
38 virtual void CleanUpOnMainThread() { 38 virtual void CleanUpOnMainThread() OVERRIDE {
39 model_->RemoveObserver(this); 39 model_->RemoveObserver(this);
40 } 40 }
41 41
42 virtual void BrowserActionAdded(const Extension* extension, int index) { 42 virtual void BrowserActionAdded(const Extension* extension,
43 int index) OVERRIDE {
43 inserted_count_++; 44 inserted_count_++;
44 } 45 }
45 46
46 virtual void BrowserActionRemoved(const Extension* extension) { 47 virtual void BrowserActionRemoved(const Extension* extension) OVERRIDE {
47 removed_count_++; 48 removed_count_++;
48 } 49 }
49 50
50 virtual void BrowserActionMoved(const Extension* extension, int index) { 51 virtual void BrowserActionMoved(const Extension* extension,
52 int index) OVERRIDE {
51 moved_count_++; 53 moved_count_++;
52 } 54 }
53 55
54 const Extension* ExtensionAt(int index) { 56 const Extension* ExtensionAt(int index) {
55 const extensions::ExtensionList& toolbar_items = model_->toolbar_items(); 57 const extensions::ExtensionList& toolbar_items = model_->toolbar_items();
56 for (extensions::ExtensionList::const_iterator i = toolbar_items.begin(); 58 for (extensions::ExtensionList::const_iterator i = toolbar_items.begin();
57 i < toolbar_items.end(); ++i) { 59 i < toolbar_items.end(); ++i) {
58 if (index-- == 0) 60 if (index-- == 0)
59 return *i; 61 return *i;
60 } 62 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 227
226 // Load extension C again. 228 // Load extension C again.
227 ASSERT_TRUE(LoadExtension(extension_c_path)); 229 ASSERT_TRUE(LoadExtension(extension_c_path));
228 230
229 // Extension C loaded again. 231 // Extension C loaded again.
230 EXPECT_EQ(5, inserted_count_); 232 EXPECT_EQ(5, inserted_count_);
231 EXPECT_EQ(2u, model_->toolbar_items().size()); 233 EXPECT_EQ(2u, model_->toolbar_items().size());
232 // Make sure it gets its old spot in the list (at the very end). 234 // Make sure it gets its old spot in the list (at the very end).
233 ASSERT_STREQ(idC.c_str(), ExtensionAt(1)->id().c_str()); 235 ASSERT_STREQ(idC.c_str(), ExtensionAt(1)->id().c_str());
234 } 236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698