OLD | NEW |
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 virtual void BrowserActionMoved(const Extension* extension, | 51 virtual void BrowserActionMoved(const Extension* extension, |
52 int index) OVERRIDE { | 52 int index) OVERRIDE { |
53 moved_count_++; | 53 moved_count_++; |
54 } | 54 } |
55 | 55 |
56 const Extension* ExtensionAt(int index) { | 56 const Extension* ExtensionAt(int index) { |
57 const extensions::ExtensionList& toolbar_items = model_->toolbar_items(); | 57 const extensions::ExtensionList& toolbar_items = model_->toolbar_items(); |
58 for (extensions::ExtensionList::const_iterator i = toolbar_items.begin(); | 58 for (extensions::ExtensionList::const_iterator i = toolbar_items.begin(); |
59 i < toolbar_items.end(); ++i) { | 59 i < toolbar_items.end(); ++i) { |
60 if (index-- == 0) | 60 if (index-- == 0) |
61 return *i; | 61 return i->get(); |
62 } | 62 } |
63 return NULL; | 63 return NULL; |
64 } | 64 } |
65 | 65 |
66 protected: | 66 protected: |
67 ExtensionToolbarModel* model_; | 67 ExtensionToolbarModel* model_; |
68 | 68 |
69 int inserted_count_; | 69 int inserted_count_; |
70 int removed_count_; | 70 int removed_count_; |
71 int moved_count_; | 71 int moved_count_; |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 new_order.push_back(id_c); | 371 new_order.push_back(id_c); |
372 new_order.push_back(id_b); | 372 new_order.push_back(id_b); |
373 extensions::ExtensionPrefs::Get(browser()->profile())->SetToolbarOrder( | 373 extensions::ExtensionPrefs::Get(browser()->profile())->SetToolbarOrder( |
374 new_order); | 374 new_order); |
375 | 375 |
376 // Verify order is changed. | 376 // Verify order is changed. |
377 EXPECT_EQ(id_c, ExtensionAt(0)->id()); | 377 EXPECT_EQ(id_c, ExtensionAt(0)->id()); |
378 EXPECT_EQ(id_b, ExtensionAt(1)->id()); | 378 EXPECT_EQ(id_b, ExtensionAt(1)->id()); |
379 EXPECT_EQ(id_a, ExtensionAt(2)->id()); | 379 EXPECT_EQ(id_a, ExtensionAt(2)->id()); |
380 } | 380 } |
OLD | NEW |