Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 void ExpandAndSelect() { 99 void ExpandAndSelect() {
100 editor_->ExpandAndSelect(); 100 editor_->ExpandAndSelect();
101 } 101 }
102 102
103 views::TreeView* tree_view() { return editor_->tree_view_; } 103 views::TreeView* tree_view() { return editor_->tree_view_; }
104 104
105 content::TestBrowserThreadBundle thread_bundle_; 105 content::TestBrowserThreadBundle thread_bundle_;
106 106
107 BookmarkModel* model_; 107 BookmarkModel* model_;
108 scoped_ptr<TestingProfile> profile_; 108 std::unique_ptr<TestingProfile> profile_;
109 109
110 private: 110 private:
111 // Creates the following structure: 111 // Creates the following structure:
112 // bookmark bar node 112 // bookmark bar node
113 // a 113 // a
114 // F1 114 // F1
115 // f1a 115 // f1a
116 // F11 116 // F11
117 // f11a 117 // f11a
118 // F2 118 // F2
(...skipping 12 matching lines...) Expand all
131 model_->AddFolder(bb_node, 2, ASCIIToUTF16("F2")); 131 model_->AddFolder(bb_node, 2, ASCIIToUTF16("F2"));
132 132
133 // Children of the other node. 133 // Children of the other node.
134 model_->AddURL(model_->other_node(), 0, ASCIIToUTF16("oa"), 134 model_->AddURL(model_->other_node(), 0, ASCIIToUTF16("oa"),
135 GURL(test_base + "oa")); 135 GURL(test_base + "oa"));
136 const BookmarkNode* of1 = 136 const BookmarkNode* of1 =
137 model_->AddFolder(model_->other_node(), 1, ASCIIToUTF16("OF1")); 137 model_->AddFolder(model_->other_node(), 1, ASCIIToUTF16("OF1"));
138 model_->AddURL(of1, 0, ASCIIToUTF16("of1a"), GURL(test_base + "of1a")); 138 model_->AddURL(of1, 0, ASCIIToUTF16("of1a"), GURL(test_base + "of1a"));
139 } 139 }
140 140
141 scoped_ptr<BookmarkEditorView> editor_; 141 std::unique_ptr<BookmarkEditorView> editor_;
142 }; 142 };
143 143
144 // Makes sure the tree model matches that of the bookmark bar model. 144 // Makes sure the tree model matches that of the bookmark bar model.
145 TEST_F(BookmarkEditorViewTest, ModelsMatch) { 145 TEST_F(BookmarkEditorViewTest, ModelsMatch) {
146 CreateEditor(profile_.get(), NULL, 146 CreateEditor(profile_.get(), NULL,
147 BookmarkEditor::EditDetails::AddNodeInFolder( 147 BookmarkEditor::EditDetails::AddNodeInFolder(
148 NULL, -1, GURL(), base::string16()), 148 NULL, -1, GURL(), base::string16()),
149 BookmarkEditorView::SHOW_TREE); 149 BookmarkEditorView::SHOW_TREE);
150 BookmarkEditorView::EditorNode* editor_root = editor_tree_model()->GetRoot(); 150 BookmarkEditorView::EditorNode* editor_root = editor_tree_model()->GetRoot();
151 // The root should have two or three children: bookmark bar, other bookmarks 151 // The root should have two or three children: bookmark bar, other bookmarks
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 ASSERT_TRUE(tree_view()->editor() != NULL); 408 ASSERT_TRUE(tree_view()->editor() != NULL);
409 tree_view()->editor()->SetText(ASCIIToUTF16("modified")); 409 tree_view()->editor()->SetText(ASCIIToUTF16("modified"));
410 ApplyEdits(); 410 ApplyEdits();
411 411
412 // Verify the new folder was added and title set appropriately. 412 // Verify the new folder was added and title set appropriately.
413 ASSERT_EQ(1, parent->child_count()); 413 ASSERT_EQ(1, parent->child_count());
414 const BookmarkNode* new_folder = parent->GetChild(0); 414 const BookmarkNode* new_folder = parent->GetChild(0);
415 ASSERT_TRUE(new_folder->is_folder()); 415 ASSERT_TRUE(new_folder->is_folder());
416 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle())); 416 EXPECT_EQ("modified", base::UTF16ToASCII(new_folder->GetTitle()));
417 } 417 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698