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" |
11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
12 #include "components/bookmarks/browser/bookmark_model.h" | 12 #include "components/bookmarks/browser/bookmark_model.h" |
13 #include "components/bookmarks/test/bookmark_test_helpers.h" | 13 #include "components/bookmarks/test/bookmark_test_helpers.h" |
14 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "ui/base/models/combobox_model_observer.h" | 16 #include "ui/base/models/combobox_model_observer.h" |
17 | 17 |
18 using bookmarks::BookmarkModel; | 18 using bookmarks::BookmarkModel; |
| 19 using bookmarks::BookmarkNode; |
19 using content::BrowserThread; | 20 using content::BrowserThread; |
20 | 21 |
21 // Implementation of ComboboxModelObserver that records when | 22 // Implementation of ComboboxModelObserver that records when |
22 // OnComboboxModelChanged() is invoked. | 23 // OnComboboxModelChanged() is invoked. |
23 class TestComboboxModelObserver : public ui::ComboboxModelObserver { | 24 class TestComboboxModelObserver : public ui::ComboboxModelObserver { |
24 public: | 25 public: |
25 TestComboboxModelObserver() : changed_(false) {} | 26 TestComboboxModelObserver() : changed_(false) {} |
26 ~TestComboboxModelObserver() override {} | 27 ~TestComboboxModelObserver() override {} |
27 | 28 |
28 // Returns whether the model changed and clears changed state. | 29 // Returns whether the model changed and clears changed state. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 const int updated_count = model.GetItemCount(); | 115 const int updated_count = model.GetItemCount(); |
115 EXPECT_LT(updated_count, initial_count); | 116 EXPECT_LT(updated_count, initial_count); |
116 | 117 |
117 // Remove all, which should remove a folder too. | 118 // Remove all, which should remove a folder too. |
118 GetModel()->RemoveAllUserBookmarks(); | 119 GetModel()->RemoveAllUserBookmarks(); |
119 EXPECT_TRUE(observer.GetAndClearChanged()); | 120 EXPECT_TRUE(observer.GetAndClearChanged()); |
120 EXPECT_LT(model.GetItemCount(), updated_count); | 121 EXPECT_LT(model.GetItemCount(), updated_count); |
121 | 122 |
122 model.RemoveObserver(&observer); | 123 model.RemoveObserver(&observer); |
123 } | 124 } |
OLD | NEW |