| 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 "ui/base/models/list_model.h" | 5 #include "ui/base/models/list_model.h" | 
| 6 | 6 | 
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" | 
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" | 
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" | 
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 40     EXPECT_EQ(removed_count, removed_count_); | 40     EXPECT_EQ(removed_count, removed_count_); | 
| 41     EXPECT_EQ(moved_count, moved_count_); | 41     EXPECT_EQ(moved_count, moved_count_); | 
| 42     EXPECT_EQ(changed_count, changed_count_); | 42     EXPECT_EQ(changed_count, changed_count_); | 
| 43   } | 43   } | 
| 44 | 44 | 
| 45   void ClearCounts() { | 45   void ClearCounts() { | 
| 46     added_count_ = removed_count_ = moved_count_ = changed_count_ = 0; | 46     added_count_ = removed_count_ = moved_count_ = changed_count_ = 0; | 
| 47   } | 47   } | 
| 48 | 48 | 
| 49   // ListModelObserver implementation: | 49   // ListModelObserver implementation: | 
| 50   virtual void ListItemsAdded(size_t start, size_t count) OVERRIDE { | 50   virtual void ListItemsAdded(size_t start, size_t count) override { | 
| 51     added_count_ += count; | 51     added_count_ += count; | 
| 52   } | 52   } | 
| 53   virtual void ListItemsRemoved(size_t start, size_t count) OVERRIDE { | 53   virtual void ListItemsRemoved(size_t start, size_t count) override { | 
| 54     removed_count_ += count; | 54     removed_count_ += count; | 
| 55   } | 55   } | 
| 56   virtual void ListItemMoved(size_t index, size_t target_index) OVERRIDE { | 56   virtual void ListItemMoved(size_t index, size_t target_index) override { | 
| 57     ++moved_count_; | 57     ++moved_count_; | 
| 58   } | 58   } | 
| 59   virtual void ListItemsChanged(size_t start, size_t count) OVERRIDE { | 59   virtual void ListItemsChanged(size_t start, size_t count) override { | 
| 60     changed_count_ += count; | 60     changed_count_ += count; | 
| 61   } | 61   } | 
| 62 | 62 | 
| 63  private: | 63  private: | 
| 64   size_t added_count_; | 64   size_t added_count_; | 
| 65   size_t removed_count_; | 65   size_t removed_count_; | 
| 66   size_t moved_count_; | 66   size_t moved_count_; | 
| 67   size_t changed_count_; | 67   size_t changed_count_; | 
| 68 | 68 | 
| 69   DISALLOW_COPY_AND_ASSIGN(ListModelTest); | 69   DISALLOW_COPY_AND_ASSIGN(ListModelTest); | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 165   ClearCounts(); | 165   ClearCounts(); | 
| 166 | 166 | 
| 167   model.NotifyItemsChanged(0, 1); | 167   model.NotifyItemsChanged(0, 1); | 
| 168   ExpectCountsEqual(0, 0, 0, 1); | 168   ExpectCountsEqual(0, 0, 0, 1); | 
| 169 | 169 | 
| 170   model.NotifyItemsChanged(1, 2); | 170   model.NotifyItemsChanged(1, 2); | 
| 171   ExpectCountsEqual(0, 0, 0, 3); | 171   ExpectCountsEqual(0, 0, 0, 3); | 
| 172 } | 172 } | 
| 173 | 173 | 
| 174 }  // namespace ui | 174 }  // namespace ui | 
| OLD | NEW | 
|---|