| 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 22 matching lines...) Expand all Loading... |
| 33 EnhancedBookmarkModelTest() | 33 EnhancedBookmarkModelTest() |
| 34 : loaded_calls_(0), | 34 : loaded_calls_(0), |
| 35 shutting_down_calls_(0), | 35 shutting_down_calls_(0), |
| 36 added_calls_(0), | 36 added_calls_(0), |
| 37 removed_calls_(0), | 37 removed_calls_(0), |
| 38 all_user_nodes_removed_calls_(0), | 38 all_user_nodes_removed_calls_(0), |
| 39 remote_id_changed_calls_(0), | 39 remote_id_changed_calls_(0), |
| 40 last_added_(NULL), | 40 last_added_(NULL), |
| 41 last_removed_(NULL), | 41 last_removed_(NULL), |
| 42 last_remote_id_node_(NULL) {} | 42 last_remote_id_node_(NULL) {} |
| 43 virtual ~EnhancedBookmarkModelTest() {} | 43 ~EnhancedBookmarkModelTest() override {} |
| 44 | 44 |
| 45 virtual void SetUp() override { | 45 void SetUp() override { |
| 46 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); | 46 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_DEFAULT)); |
| 47 bookmark_client_.reset(new bookmarks::TestBookmarkClient()); | 47 bookmark_client_.reset(new bookmarks::TestBookmarkClient()); |
| 48 bookmark_model_.reset(bookmark_client_->CreateModel().release()); | 48 bookmark_model_.reset(bookmark_client_->CreateModel().release()); |
| 49 model_.reset(new EnhancedBookmarkModel(bookmark_model_.get(), "v1.0")); | 49 model_.reset(new EnhancedBookmarkModel(bookmark_model_.get(), "v1.0")); |
| 50 model_->AddObserver(this); | 50 model_->AddObserver(this); |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual void TearDown() override { | 53 void TearDown() override { |
| 54 if (model_) | 54 if (model_) |
| 55 model_->Shutdown(); | 55 model_->Shutdown(); |
| 56 model_.reset(); | 56 model_.reset(); |
| 57 bookmark_model_.reset(); | 57 bookmark_model_.reset(); |
| 58 bookmark_client_.reset(); | 58 bookmark_client_.reset(); |
| 59 message_loop_.reset(); | 59 message_loop_.reset(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 protected: | 62 protected: |
| 63 const BookmarkNode* AddBookmark() { | 63 const BookmarkNode* AddBookmark() { |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 TEST_F(EnhancedBookmarkModelTest, | 728 TEST_F(EnhancedBookmarkModelTest, |
| 729 NodeRemovedWhileSetNeedsOfflineProcessingIsScheduled) { | 729 NodeRemovedWhileSetNeedsOfflineProcessingIsScheduled) { |
| 730 const BookmarkNode* node = | 730 const BookmarkNode* node = |
| 731 bookmark_model_->AddURL(bookmark_model_->other_node(), | 731 bookmark_model_->AddURL(bookmark_model_->other_node(), |
| 732 0, | 732 0, |
| 733 base::ASCIIToUTF16("Some title"), | 733 base::ASCIIToUTF16("Some title"), |
| 734 GURL(BOOKMARK_URL)); | 734 GURL(BOOKMARK_URL)); |
| 735 bookmark_model_->Remove(node->parent(), node->parent()->GetIndexOf(node)); | 735 bookmark_model_->Remove(node->parent(), node->parent()->GetIndexOf(node)); |
| 736 base::RunLoop().RunUntilIdle(); | 736 base::RunLoop().RunUntilIdle(); |
| 737 } | 737 } |
| OLD | NEW |