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