| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const BookmarkNode* sub_folder = GetModel()->AddFolder( | 103 const BookmarkNode* sub_folder = GetModel()->AddFolder( |
| 104 folder, 0, base::ASCIIToUTF16("b")); | 104 folder, 0, base::ASCIIToUTF16("b")); |
| 105 const BookmarkNode* new_node = GetModel()->AddURL( | 105 const BookmarkNode* new_node = GetModel()->AddURL( |
| 106 sub_folder, 0, base::ASCIIToUTF16("a"), GURL("http://a")); | 106 sub_folder, 0, base::ASCIIToUTF16("a"), GURL("http://a")); |
| 107 RecentlyUsedFoldersComboModel model(GetModel(), new_node); | 107 RecentlyUsedFoldersComboModel model(GetModel(), new_node); |
| 108 TestComboboxModelObserver observer; | 108 TestComboboxModelObserver observer; |
| 109 model.AddObserver(&observer); | 109 model.AddObserver(&observer); |
| 110 | 110 |
| 111 const int initial_count = model.GetItemCount(); | 111 const int initial_count = model.GetItemCount(); |
| 112 // Remove a folder, it should remove an item from the model too. | 112 // Remove a folder, it should remove an item from the model too. |
| 113 GetModel()->Remove(folder, folder->GetIndexOf(sub_folder)); | 113 GetModel()->Remove(sub_folder); |
| 114 EXPECT_TRUE(observer.GetAndClearChanged()); | 114 EXPECT_TRUE(observer.GetAndClearChanged()); |
| 115 const int updated_count = model.GetItemCount(); | 115 const int updated_count = model.GetItemCount(); |
| 116 EXPECT_LT(updated_count, initial_count); | 116 EXPECT_LT(updated_count, initial_count); |
| 117 | 117 |
| 118 // Remove all, which should remove a folder too. | 118 // Remove all, which should remove a folder too. |
| 119 GetModel()->RemoveAllUserBookmarks(); | 119 GetModel()->RemoveAllUserBookmarks(); |
| 120 EXPECT_TRUE(observer.GetAndClearChanged()); | 120 EXPECT_TRUE(observer.GetAndClearChanged()); |
| 121 EXPECT_LT(model.GetItemCount(), updated_count); | 121 EXPECT_LT(model.GetItemCount(), updated_count); |
| 122 | 122 |
| 123 model.RemoveObserver(&observer); | 123 model.RemoveObserver(&observer); |
| 124 } | 124 } |
| OLD | NEW |