OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/launcher/launcher_model.h" | 5 #include "ash/launcher/launcher_model.h" |
6 | 6 |
| 7 #include <set> |
| 8 #include <string> |
| 9 |
7 #include "ash/launcher/launcher_model_observer.h" | 10 #include "ash/launcher/launcher_model_observer.h" |
8 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
10 | 13 |
11 namespace ash { | 14 namespace ash { |
12 | 15 |
13 namespace { | 16 namespace { |
14 | 17 |
15 // LauncherModelObserver implementation that tracks what message are invoked. | 18 // LauncherModelObserver implementation that tracks what message are invoked. |
16 class TestLauncherModelObserver : public LauncherModelObserver { | 19 class TestLauncherModelObserver : public LauncherModelObserver { |
(...skipping 24 matching lines...) Expand all Loading... |
41 virtual void LauncherItemRemoved(int index, LauncherID id) OVERRIDE { | 44 virtual void LauncherItemRemoved(int index, LauncherID id) OVERRIDE { |
42 removed_count_++; | 45 removed_count_++; |
43 } | 46 } |
44 virtual void LauncherItemChanged(int index, | 47 virtual void LauncherItemChanged(int index, |
45 const LauncherItem& old_item) OVERRIDE { | 48 const LauncherItem& old_item) OVERRIDE { |
46 changed_count_++; | 49 changed_count_++; |
47 } | 50 } |
48 virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE { | 51 virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE { |
49 moved_count_++; | 52 moved_count_++; |
50 } | 53 } |
| 54 virtual void LauncherStatusChanged() OVERRIDE { |
| 55 } |
51 | 56 |
52 private: | 57 private: |
53 void AddToResult(const std::string& format, int count, std::string* result) { | 58 void AddToResult(const std::string& format, int count, std::string* result) { |
54 if (!count) | 59 if (!count) |
55 return; | 60 return; |
56 if (!result->empty()) | 61 if (!result->empty()) |
57 *result += " "; | 62 *result += " "; |
58 *result += base::StringPrintf(format.c_str(), count); | 63 *result += base::StringPrintf(format.c_str(), count); |
59 } | 64 } |
60 | 65 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 item.type = TYPE_APP_PANEL; | 195 item.type = TYPE_APP_PANEL; |
191 int app_panel_index3 = model.AddAt(8, item); | 196 int app_panel_index3 = model.AddAt(8, item); |
192 EXPECT_EQ(8, app_panel_index3); | 197 EXPECT_EQ(8, app_panel_index3); |
193 | 198 |
194 // Browser shortcut and app list should still be first and last, respectively. | 199 // Browser shortcut and app list should still be first and last, respectively. |
195 EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[0].type); | 200 EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[0].type); |
196 EXPECT_EQ(TYPE_APP_LIST, model.items()[model.item_count() - 1].type); | 201 EXPECT_EQ(TYPE_APP_LIST, model.items()[model.item_count() - 1].type); |
197 } | 202 } |
198 | 203 |
199 } // namespace ash | 204 } // namespace ash |
OLD | NEW |