| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/enhanced_bookmarks/enhanced_bookmark_model.h" | 5 #include "components/enhanced_bookmarks/enhanced_bookmark_model.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 return std::string(); | 101 return std::string(); |
| 102 return value; | 102 return value; |
| 103 } | 103 } |
| 104 | 104 |
| 105 scoped_ptr<base::MessageLoop> message_loop_; | 105 scoped_ptr<base::MessageLoop> message_loop_; |
| 106 scoped_ptr<bookmarks::TestBookmarkClient> bookmark_client_; | 106 scoped_ptr<bookmarks::TestBookmarkClient> bookmark_client_; |
| 107 scoped_ptr<BookmarkModel> bookmark_model_; | 107 scoped_ptr<BookmarkModel> bookmark_model_; |
| 108 scoped_ptr<EnhancedBookmarkModel> model_; | 108 scoped_ptr<EnhancedBookmarkModel> model_; |
| 109 | 109 |
| 110 // EnhancedBookmarkModelObserver implementation: | 110 // EnhancedBookmarkModelObserver implementation: |
| 111 virtual void EnhancedBookmarkModelLoaded() override { loaded_calls_++; } | 111 void EnhancedBookmarkModelLoaded() override { loaded_calls_++; } |
| 112 virtual void EnhancedBookmarkModelShuttingDown() override { | 112 void EnhancedBookmarkModelShuttingDown() override { shutting_down_calls_++; } |
| 113 shutting_down_calls_++; | 113 void EnhancedBookmarkAdded(const BookmarkNode* node) override { |
| 114 } | |
| 115 virtual void EnhancedBookmarkAdded(const BookmarkNode* node) override { | |
| 116 added_calls_++; | 114 added_calls_++; |
| 117 last_added_ = node; | 115 last_added_ = node; |
| 118 } | 116 } |
| 119 virtual void EnhancedBookmarkRemoved(const BookmarkNode* node) override { | 117 void EnhancedBookmarkRemoved(const BookmarkNode* node) override { |
| 120 removed_calls_++; | 118 removed_calls_++; |
| 121 last_removed_ = node; | 119 last_removed_ = node; |
| 122 } | 120 } |
| 123 virtual void EnhancedBookmarkAllUserNodesRemoved() override { | 121 void EnhancedBookmarkAllUserNodesRemoved() override { |
| 124 all_user_nodes_removed_calls_++; | 122 all_user_nodes_removed_calls_++; |
| 125 } | 123 } |
| 126 virtual void EnhancedBookmarkRemoteIdChanged( | 124 void EnhancedBookmarkRemoteIdChanged(const BookmarkNode* node, |
| 127 const BookmarkNode* node, | 125 const std::string& old_remote_id, |
| 128 const std::string& old_remote_id, | 126 const std::string& remote_id) override { |
| 129 const std::string& remote_id) override { | |
| 130 remote_id_changed_calls_++; | 127 remote_id_changed_calls_++; |
| 131 last_remote_id_node_ = node; | 128 last_remote_id_node_ = node; |
| 132 last_old_remote_id_ = old_remote_id; | 129 last_old_remote_id_ = old_remote_id; |
| 133 last_remote_id_ = remote_id; | 130 last_remote_id_ = remote_id; |
| 134 } | 131 } |
| 135 | 132 |
| 136 // Observer call counters: | 133 // Observer call counters: |
| 137 int loaded_calls_; | 134 int loaded_calls_; |
| 138 int shutting_down_calls_; | 135 int shutting_down_calls_; |
| 139 int added_calls_; | 136 int added_calls_; |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 TEST_F(EnhancedBookmarkModelTest, | 728 TEST_F(EnhancedBookmarkModelTest, |
| 732 NodeRemovedWhileSetNeedsOfflineProcessingIsScheduled) { | 729 NodeRemovedWhileSetNeedsOfflineProcessingIsScheduled) { |
| 733 const BookmarkNode* node = | 730 const BookmarkNode* node = |
| 734 bookmark_model_->AddURL(bookmark_model_->other_node(), | 731 bookmark_model_->AddURL(bookmark_model_->other_node(), |
| 735 0, | 732 0, |
| 736 base::ASCIIToUTF16("Some title"), | 733 base::ASCIIToUTF16("Some title"), |
| 737 GURL(BOOKMARK_URL)); | 734 GURL(BOOKMARK_URL)); |
| 738 bookmark_model_->Remove(node->parent(), node->parent()->GetIndexOf(node)); | 735 bookmark_model_->Remove(node->parent(), node->parent()->GetIndexOf(node)); |
| 739 base::RunLoop().RunUntilIdle(); | 736 base::RunLoop().RunUntilIdle(); |
| 740 } | 737 } |
| OLD | NEW |