OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/shelf_model.h" | 5 #include "ash/shelf/shelf_model.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // ShelfModelObserver overrides: | 42 // ShelfModelObserver overrides: |
43 void ShelfItemAdded(int index) override { added_count_++; } | 43 void ShelfItemAdded(int index) override { added_count_++; } |
44 void ShelfItemRemoved(int index, ShelfID id) override { removed_count_++; } | 44 void ShelfItemRemoved(int index, ShelfID id) override { removed_count_++; } |
45 void ShelfItemChanged(int index, const ShelfItem& old_item) override { | 45 void ShelfItemChanged(int index, const ShelfItem& old_item) override { |
46 changed_count_++; | 46 changed_count_++; |
47 } | 47 } |
48 void ShelfItemMoved(int start_index, int target_index) override { | 48 void ShelfItemMoved(int start_index, int target_index) override { |
49 moved_count_++; | 49 moved_count_++; |
50 } | 50 } |
51 void ShelfStatusChanged() override {} | |
52 | 51 |
53 private: | 52 private: |
54 void AddToResult(const std::string& format, int count, std::string* result) { | 53 void AddToResult(const std::string& format, int count, std::string* result) { |
55 if (!count) | 54 if (!count) |
56 return; | 55 return; |
57 if (!result->empty()) | 56 if (!result->empty()) |
58 *result += " "; | 57 *result += " "; |
59 *result += base::StringPrintf(format.c_str(), count); | 58 *result += base::StringPrintf(format.c_str(), count); |
60 } | 59 } |
61 | 60 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 // Now change the type of the second item and make sure that it is moving | 342 // Now change the type of the second item and make sure that it is moving |
344 // behind the shortcuts. | 343 // behind the shortcuts. |
345 item.type = TYPE_PLATFORM_APP; | 344 item.type = TYPE_PLATFORM_APP; |
346 model_->Set(app2_index, item); | 345 model_->Set(app2_index, item); |
347 | 346 |
348 // The item should have moved in front of the app launcher. | 347 // The item should have moved in front of the app launcher. |
349 EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type); | 348 EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type); |
350 } | 349 } |
351 | 350 |
352 } // namespace ash | 351 } // namespace ash |
OLD | NEW |