| 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 "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" | 5 #include "chrome/browser/ui/bookmarks/recently_used_folders_combo_model.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 virtual ~TestComboboxModelObserver() {} | 25 virtual ~TestComboboxModelObserver() {} |
| 26 | 26 |
| 27 // Returns whether the model changed and clears changed state. | 27 // Returns whether the model changed and clears changed state. |
| 28 bool GetAndClearChanged() { | 28 bool GetAndClearChanged() { |
| 29 const bool changed = changed_; | 29 const bool changed = changed_; |
| 30 changed_ = false; | 30 changed_ = false; |
| 31 return changed; | 31 return changed; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // ComboboxModelObserver: | 34 // ComboboxModelObserver: |
| 35 virtual void OnComboboxModelChanged(ui::ComboboxModel* model) OVERRIDE { | 35 virtual void OnComboboxModelChanged(ui::ComboboxModel* model) override { |
| 36 changed_ = true; | 36 changed_ = true; |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 bool changed_; | 40 bool changed_; |
| 41 | 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(TestComboboxModelObserver); | 42 DISALLOW_COPY_AND_ASSIGN(TestComboboxModelObserver); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class RecentlyUsedFoldersComboModelTest : public testing::Test { | 45 class RecentlyUsedFoldersComboModelTest : public testing::Test { |
| 46 public: | 46 public: |
| 47 RecentlyUsedFoldersComboModelTest(); | 47 RecentlyUsedFoldersComboModelTest(); |
| 48 | 48 |
| 49 virtual void SetUp() OVERRIDE; | 49 virtual void SetUp() override; |
| 50 virtual void TearDown() OVERRIDE; | 50 virtual void TearDown() override; |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 BookmarkModel* GetModel(); | 53 BookmarkModel* GetModel(); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 base::MessageLoopForUI message_loop_; | 56 base::MessageLoopForUI message_loop_; |
| 57 content::TestBrowserThread ui_thread_; | 57 content::TestBrowserThread ui_thread_; |
| 58 content::TestBrowserThread file_thread_; | 58 content::TestBrowserThread file_thread_; |
| 59 scoped_ptr<TestingProfile> profile_; | 59 scoped_ptr<TestingProfile> profile_; |
| 60 | 60 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 const int updated_count = model.GetItemCount(); | 113 const int updated_count = model.GetItemCount(); |
| 114 EXPECT_LT(updated_count, initial_count); | 114 EXPECT_LT(updated_count, initial_count); |
| 115 | 115 |
| 116 // Remove all, which should remove a folder too. | 116 // Remove all, which should remove a folder too. |
| 117 GetModel()->RemoveAllUserBookmarks(); | 117 GetModel()->RemoveAllUserBookmarks(); |
| 118 EXPECT_TRUE(observer.GetAndClearChanged()); | 118 EXPECT_TRUE(observer.GetAndClearChanged()); |
| 119 EXPECT_LT(model.GetItemCount(), updated_count); | 119 EXPECT_LT(model.GetItemCount(), updated_count); |
| 120 | 120 |
| 121 model.RemoveObserver(&observer); | 121 model.RemoveObserver(&observer); |
| 122 } | 122 } |
| OLD | NEW |