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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 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) 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_toolbar_model.h" 7 #include "chrome/browser/extensions/extension_toolbar_model.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
12 12
13 using extensions::Extension;
14
13 // An InProcessBrowserTest for testing the ExtensionToolbarModel. 15 // An InProcessBrowserTest for testing the ExtensionToolbarModel.
14 // TODO(erikkay) It's unfortunate that this needs to be an in-proc browser test. 16 // TODO(erikkay) It's unfortunate that this needs to be an in-proc browser test.
15 // It would be nice to refactor things so that ExtensionService could run 17 // It would be nice to refactor things so that ExtensionService could run
16 // without so much of the browser in place. 18 // without so much of the browser in place.
17 class ExtensionToolbarModelTest : public ExtensionBrowserTest, 19 class ExtensionToolbarModelTest : public ExtensionBrowserTest,
18 public ExtensionToolbarModel::Observer { 20 public ExtensionToolbarModel::Observer {
19 public: 21 public:
20 virtual void SetUp() { 22 virtual void SetUp() {
21 inserted_count_ = 0; 23 inserted_count_ = 0;
22 removed_count_ = 0; 24 removed_count_ = 0;
(...skipping 18 matching lines...) Expand all
41 43
42 virtual void BrowserActionRemoved(const Extension* extension) { 44 virtual void BrowserActionRemoved(const Extension* extension) {
43 removed_count_++; 45 removed_count_++;
44 } 46 }
45 47
46 virtual void BrowserActionMoved(const Extension* extension, int index) { 48 virtual void BrowserActionMoved(const Extension* extension, int index) {
47 moved_count_++; 49 moved_count_++;
48 } 50 }
49 51
50 const Extension* ExtensionAt(int index) { 52 const Extension* ExtensionAt(int index) {
51 for (ExtensionList::iterator i = model_->begin(); i < model_->end(); ++i) { 53 for (extensions::ExtensionList::iterator i = model_->begin();
54 i < model_->end(); ++i) {
52 if (index-- == 0) 55 if (index-- == 0)
53 return *i; 56 return *i;
54 } 57 }
55 return NULL; 58 return NULL;
56 } 59 }
57 60
58 protected: 61 protected:
59 ExtensionToolbarModel* model_; 62 ExtensionToolbarModel* model_;
60 63
61 int inserted_count_; 64 int inserted_count_;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 222
220 // Load extension C again. 223 // Load extension C again.
221 ASSERT_TRUE(LoadExtension(extension_c_path)); 224 ASSERT_TRUE(LoadExtension(extension_c_path));
222 225
223 // Extension C loaded again. 226 // Extension C loaded again.
224 EXPECT_EQ(5, inserted_count_); 227 EXPECT_EQ(5, inserted_count_);
225 EXPECT_EQ(2u, model_->size()); 228 EXPECT_EQ(2u, model_->size());
226 // Make sure it gets its old spot in the list (at the very end). 229 // Make sure it gets its old spot in the list (at the very end).
227 ASSERT_STREQ(idC.c_str(), ExtensionAt(1)->id().c_str()); 230 ASSERT_STREQ(idC.c_str(), ExtensionAt(1)->id().c_str());
228 } 231 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_toolbar_model.cc ('k') | chrome/browser/extensions/extension_ui_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698