| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/undo/bookmark_undo_service.h" | 5 #include "components/undo/bookmark_undo_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> |
| 10 |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 11 #include "components/bookmarks/browser/bookmark_model.h" | 13 #include "components/bookmarks/browser/bookmark_model.h" |
| 12 #include "components/bookmarks/test/bookmark_test_helpers.h" | 14 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 13 #include "components/bookmarks/test/test_bookmark_client.h" | 15 #include "components/bookmarks/test/test_bookmark_client.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 17 |
| 16 using base::ASCIIToUTF16; | 18 using base::ASCIIToUTF16; |
| 17 using bookmarks::BookmarkModel; | 19 using bookmarks::BookmarkModel; |
| 18 using bookmarks::BookmarkNode; | 20 using bookmarks::BookmarkNode; |
| 19 | 21 |
| 20 namespace { | 22 namespace { |
| 21 | 23 |
| 22 class BookmarkUndoServiceTest : public testing::Test { | 24 class BookmarkUndoServiceTest : public testing::Test { |
| 23 public: | 25 public: |
| 24 BookmarkUndoServiceTest(); | 26 BookmarkUndoServiceTest(); |
| 25 | 27 |
| 26 void SetUp() override; | 28 void SetUp() override; |
| 27 void TearDown() override; | 29 void TearDown() override; |
| 28 | 30 |
| 29 BookmarkModel* GetModel(); | 31 BookmarkModel* GetModel(); |
| 30 BookmarkUndoService* GetUndoService(); | 32 BookmarkUndoService* GetUndoService(); |
| 31 | 33 |
| 32 private: | 34 private: |
| 33 scoped_ptr<bookmarks::BookmarkModel> bookmark_model_; | 35 std::unique_ptr<bookmarks::BookmarkModel> bookmark_model_; |
| 34 scoped_ptr<BookmarkUndoService> bookmark_undo_service_; | 36 std::unique_ptr<BookmarkUndoService> bookmark_undo_service_; |
| 35 | 37 |
| 36 DISALLOW_COPY_AND_ASSIGN(BookmarkUndoServiceTest); | 38 DISALLOW_COPY_AND_ASSIGN(BookmarkUndoServiceTest); |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 BookmarkUndoServiceTest::BookmarkUndoServiceTest() {} | 41 BookmarkUndoServiceTest::BookmarkUndoServiceTest() {} |
| 40 | 42 |
| 41 void BookmarkUndoServiceTest::SetUp() { | 43 void BookmarkUndoServiceTest::SetUp() { |
| 42 DCHECK(!bookmark_model_); | 44 DCHECK(!bookmark_model_); |
| 43 DCHECK(!bookmark_undo_service_); | 45 DCHECK(!bookmark_undo_service_); |
| 44 bookmark_model_ = bookmarks::TestBookmarkClient::CreateModel(); | 46 bookmark_model_ = bookmarks::TestBookmarkClient::CreateModel(); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 while (undo_service->undo_manager()->undo_count()) | 455 while (undo_service->undo_manager()->undo_count()) |
| 454 undo_service->undo_manager()->Undo(); | 456 undo_service->undo_manager()->Undo(); |
| 455 | 457 |
| 456 EXPECT_EQ(1, parent->child_count()); | 458 EXPECT_EQ(1, parent->child_count()); |
| 457 const BookmarkNode* node = model->other_node()->GetChild(0); | 459 const BookmarkNode* node = model->other_node()->GetChild(0); |
| 458 EXPECT_EQ(node->GetTitle(), ASCIIToUTF16("foo")); | 460 EXPECT_EQ(node->GetTitle(), ASCIIToUTF16("foo")); |
| 459 EXPECT_EQ(node->url(), GURL("http://www.foo.com")); | 461 EXPECT_EQ(node->url(), GURL("http://www.foo.com")); |
| 460 } | 462 } |
| 461 | 463 |
| 462 } // namespace | 464 } // namespace |
| OLD | NEW |