| 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/views/bookmarks/bookmark_editor_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Base class for bookmark editor tests. Creates a BookmarkModel and populates | 28 // Base class for bookmark editor tests. Creates a BookmarkModel and populates |
| 29 // it with test data. | 29 // it with test data. |
| 30 class BookmarkEditorViewTest : public testing::Test { | 30 class BookmarkEditorViewTest : public testing::Test { |
| 31 public: | 31 public: |
| 32 BookmarkEditorViewTest() | 32 BookmarkEditorViewTest() |
| 33 : ui_thread_(BrowserThread::UI, &message_loop_), | 33 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 34 file_thread_(BrowserThread::FILE, &message_loop_), | 34 file_thread_(BrowserThread::FILE, &message_loop_), |
| 35 model_(NULL) { | 35 model_(NULL) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual void SetUp() { | 38 void SetUp() override { |
| 39 profile_.reset(new TestingProfile()); | 39 profile_.reset(new TestingProfile()); |
| 40 profile_->CreateBookmarkModel(true); | 40 profile_->CreateBookmarkModel(true); |
| 41 | 41 |
| 42 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); | 42 model_ = BookmarkModelFactory::GetForProfile(profile_.get()); |
| 43 bookmarks::test::WaitForBookmarkModelToLoad(model_); | 43 bookmarks::test::WaitForBookmarkModelToLoad(model_); |
| 44 | 44 |
| 45 AddTestData(); | 45 AddTestData(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual void TearDown() { | 48 void TearDown() override {} |
| 49 } | |
| 50 | 49 |
| 51 protected: | 50 protected: |
| 52 std::string base_path() const { return "file:///c:/tmp/"; } | 51 std::string base_path() const { return "file:///c:/tmp/"; } |
| 53 | 52 |
| 54 const BookmarkNode* GetNode(const std::string& name) { | 53 const BookmarkNode* GetNode(const std::string& name) { |
| 55 return model_->GetMostRecentlyAddedUserNodeForURL(GURL(base_path() + name)); | 54 return model_->GetMostRecentlyAddedUserNodeForURL(GURL(base_path() + name)); |
| 56 } | 55 } |
| 57 | 56 |
| 58 BookmarkNode* GetMutableNode(const std::string& name) { | 57 BookmarkNode* GetMutableNode(const std::string& name) { |
| 59 return const_cast<BookmarkNode*>(GetNode(name)); | 58 return const_cast<BookmarkNode*>(GetNode(name)); |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 ASSERT_TRUE(tree_view()->editor() != NULL); | 426 ASSERT_TRUE(tree_view()->editor() != NULL); |
| 428 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); | 427 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); |
| 429 ApplyEdits(); | 428 ApplyEdits(); |
| 430 | 429 |
| 431 // Verify the new folder was added and title set appropriately. | 430 // Verify the new folder was added and title set appropriately. |
| 432 ASSERT_EQ(1, parent->child_count()); | 431 ASSERT_EQ(1, parent->child_count()); |
| 433 const BookmarkNode* new_folder = parent->GetChild(0); | 432 const BookmarkNode* new_folder = parent->GetChild(0); |
| 434 ASSERT_TRUE(new_folder->is_folder()); | 433 ASSERT_TRUE(new_folder->is_folder()); |
| 435 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); | 434 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); |
| 436 } | 435 } |
| OLD | NEW |