| 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 "ui/app_list/app_list_model.h" | 5 #include "ui/app_list/app_list_model.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 class TestObserver : public AppListModelObserver { | 24 class TestObserver : public AppListModelObserver { |
| 25 public: | 25 public: |
| 26 TestObserver() | 26 TestObserver() |
| 27 : status_changed_count_(0), | 27 : status_changed_count_(0), |
| 28 items_added_(0), | 28 items_added_(0), |
| 29 items_removed_(0), | 29 items_removed_(0), |
| 30 items_updated_(0) { | 30 items_updated_(0) { |
| 31 } | 31 } |
| 32 virtual ~TestObserver() { | 32 ~TestObserver() override {} |
| 33 } | |
| 34 | 33 |
| 35 // AppListModelObserver | 34 // AppListModelObserver |
| 36 virtual void OnAppListModelStatusChanged() override { | 35 void OnAppListModelStatusChanged() override { ++status_changed_count_; } |
| 37 ++status_changed_count_; | |
| 38 } | |
| 39 | 36 |
| 40 virtual void OnAppListItemAdded(AppListItem* item) override { | 37 void OnAppListItemAdded(AppListItem* item) override { items_added_++; } |
| 41 items_added_++; | |
| 42 } | |
| 43 | 38 |
| 44 virtual void OnAppListItemWillBeDeleted(AppListItem* item) override { | 39 void OnAppListItemWillBeDeleted(AppListItem* item) override { |
| 45 items_removed_++; | 40 items_removed_++; |
| 46 } | 41 } |
| 47 | 42 |
| 48 virtual void OnAppListItemUpdated(AppListItem* item) override { | 43 void OnAppListItemUpdated(AppListItem* item) override { items_updated_++; } |
| 49 items_updated_++; | |
| 50 } | |
| 51 | 44 |
| 52 int status_changed_count() const { return status_changed_count_; } | 45 int status_changed_count() const { return status_changed_count_; } |
| 53 size_t items_added() { return items_added_; } | 46 size_t items_added() { return items_added_; } |
| 54 size_t items_removed() { return items_removed_; } | 47 size_t items_removed() { return items_removed_; } |
| 55 size_t items_updated() { return items_updated_; } | 48 size_t items_updated() { return items_updated_; } |
| 56 | 49 |
| 57 void ResetCounts() { | 50 void ResetCounts() { |
| 58 status_changed_count_ = 0; | 51 status_changed_count_ = 0; |
| 59 items_added_ = 0; | 52 items_added_ = 0; |
| 60 items_removed_ = 0; | 53 items_removed_ = 0; |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 model_.SetFoldersEnabled(false); | 508 model_.SetFoldersEnabled(false); |
| 516 ASSERT_FALSE(model_.FindFolderItem(folder_id)); | 509 ASSERT_FALSE(model_.FindFolderItem(folder_id)); |
| 517 ASSERT_TRUE(model_.FindFolderItem(oem_folder_id)); | 510 ASSERT_TRUE(model_.FindFolderItem(oem_folder_id)); |
| 518 EXPECT_EQ("Item 0,Item 1,oem_folder", GetModelContents()); | 511 EXPECT_EQ("Item 0,Item 1,oem_folder", GetModelContents()); |
| 519 | 512 |
| 520 // Ensure folder creation fails. | 513 // Ensure folder creation fails. |
| 521 EXPECT_EQ(std::string(), model_.MergeItems(item0->id(), item1->id())); | 514 EXPECT_EQ(std::string(), model_.MergeItems(item0->id(), item1->id())); |
| 522 } | 515 } |
| 523 | 516 |
| 524 } // namespace app_list | 517 } // namespace app_list |
| OLD | NEW |