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

Side by Side Diff: components/bookmarks/browser/bookmark_utils_unittest.cc

Issue 2834073003: Replace unique_ptr.reset(other_unique_ptr.release()) with std::move() in chrome (Closed)
Patch Set: Replace unique_ptr.reset(other_unique_ptr.release()) with std::move() in chrome Created 3 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
« no previous file with comments | « no previous file | components/feature_engagement_tracker/internal/in_memory_store_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bookmarks/browser/bookmark_utils.h" 5 #include "components/bookmarks/browser/bookmark_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 std::unique_ptr<base::string16>* fields[] = {&query.word_phrase_query, 235 std::unique_ptr<base::string16>* fields[] = {&query.word_phrase_query,
236 &query.url, &query.title}; 236 &query.url, &query.title};
237 237
238 // Test two fields matching. 238 // Test two fields matching.
239 for (size_t i = 0; i < arraysize(fields); i++) { 239 for (size_t i = 0; i < arraysize(fields); i++) {
240 std::unique_ptr<base::string16> original_value(fields[i]->release()); 240 std::unique_ptr<base::string16> original_value(fields[i]->release());
241 GetBookmarksMatchingProperties(model.get(), query, 100, &nodes); 241 GetBookmarksMatchingProperties(model.get(), query, 100, &nodes);
242 ASSERT_EQ(1U, nodes.size()); 242 ASSERT_EQ(1U, nodes.size());
243 EXPECT_TRUE(nodes[0] == node1); 243 EXPECT_TRUE(nodes[0] == node1);
244 nodes.clear(); 244 nodes.clear();
245 fields[i]->reset(original_value.release()); 245 *fields[i] = std::move(original_value);
246 } 246 }
247 247
248 // Test two fields matching with one non-matching field. 248 // Test two fields matching with one non-matching field.
249 for (size_t i = 0; i < arraysize(fields); i++) { 249 for (size_t i = 0; i < arraysize(fields); i++) {
250 std::unique_ptr<base::string16> original_value(fields[i]->release()); 250 std::unique_ptr<base::string16> original_value(fields[i]->release());
251 fields[i]->reset(new base::string16(ASCIIToUTF16("fjdkslafjkldsa"))); 251 fields[i]->reset(new base::string16(ASCIIToUTF16("fjdkslafjkldsa")));
252 GetBookmarksMatchingProperties(model.get(), query, 100, &nodes); 252 GetBookmarksMatchingProperties(model.get(), query, 100, &nodes);
253 ASSERT_EQ(0U, nodes.size()); 253 ASSERT_EQ(0U, nodes.size());
254 nodes.clear(); 254 nodes.clear();
255 fields[i]->reset(original_value.release()); 255 *fields[i] = std::move(original_value);
256 } 256 }
257 } 257 }
258 258
259 // Copy and paste is not yet supported on iOS. http://crbug.com/228147 259 // Copy and paste is not yet supported on iOS. http://crbug.com/228147
260 #if !defined(OS_IOS) 260 #if !defined(OS_IOS)
261 TEST_F(BookmarkUtilsTest, PasteBookmarkFromURL) { 261 TEST_F(BookmarkUtilsTest, PasteBookmarkFromURL) {
262 std::unique_ptr<BookmarkModel> model(TestBookmarkClient::CreateModel()); 262 std::unique_ptr<BookmarkModel> model(TestBookmarkClient::CreateModel());
263 const base::string16 url_text = ASCIIToUTF16("http://www.google.com/"); 263 const base::string16 url_text = ASCIIToUTF16("http://www.google.com/");
264 const BookmarkNode* new_folder = model->AddFolder( 264 const BookmarkNode* new_folder = model->AddFolder(
265 model->bookmark_bar_node(), 0, ASCIIToUTF16("New_Folder")); 265 model->bookmark_bar_node(), 0, ASCIIToUTF16("New_Folder"));
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 model->GetNodesByURL(url, &nodes); 598 model->GetNodesByURL(url, &nodes);
599 ASSERT_EQ(1u, nodes.size()); 599 ASSERT_EQ(1u, nodes.size());
600 EXPECT_TRUE(model->bookmark_bar_node()->empty()); 600 EXPECT_TRUE(model->bookmark_bar_node()->empty());
601 EXPECT_TRUE(model->other_node()->empty()); 601 EXPECT_TRUE(model->other_node()->empty());
602 EXPECT_TRUE(model->mobile_node()->empty()); 602 EXPECT_TRUE(model->mobile_node()->empty());
603 EXPECT_EQ(1, extra_node->child_count()); 603 EXPECT_EQ(1, extra_node->child_count());
604 } 604 }
605 605
606 } // namespace 606 } // namespace
607 } // namespace bookmarks 607 } // namespace bookmarks
OLDNEW
« no previous file with comments | « no previous file | components/feature_engagement_tracker/internal/in_memory_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698