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

Side by Side Diff: chrome/browser/bookmarks/bookmark_model_unittest.cc

Issue 11411346: Bookmark: change Move() with no effect to keep the folder timestamp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 // And remove the folder. 510 // And remove the folder.
511 ClearCounts(); 511 ClearCounts();
512 model_.Remove(root, 0); 512 model_.Remove(root, 0);
513 AssertObserverCount(0, 0, 1, 0, 0); 513 AssertObserverCount(0, 0, 1, 0, 0);
514 observer_details_.ExpectEquals(root, NULL, 0, -1); 514 observer_details_.ExpectEquals(root, NULL, 0, -1);
515 EXPECT_TRUE(model_.GetMostRecentlyAddedNodeForURL(url) == NULL); 515 EXPECT_TRUE(model_.GetMostRecentlyAddedNodeForURL(url) == NULL);
516 EXPECT_EQ(0, root->child_count()); 516 EXPECT_EQ(0, root->child_count());
517 } 517 }
518 518
519 TEST_F(BookmarkModelTest, NonMovingMoveCall) {
520 const BookmarkNode* root = model_.bookmark_bar_node();
521 const string16 title(ASCIIToUTF16("foo"));
522 const GURL url("http://foo.com");
523 const base::Time old_date(base::Time::Now() - base::TimeDelta::FromDays(1));
524
525 const BookmarkNode* node = model_.AddURL(root, 0, title, url);
526 model_.SetDateFolderModified(root, old_date);
527
528 // Since |node| is already at the index 0 of |root|, this is no-op.
529 model_.Move(node, root, 0);
530
531 // Check that the modification date is kept untouched.
532 EXPECT_EQ(old_date, root->date_folder_modified());
533 }
534
519 TEST_F(BookmarkModelTest, Copy) { 535 TEST_F(BookmarkModelTest, Copy) {
520 const BookmarkNode* root = model_.bookmark_bar_node(); 536 const BookmarkNode* root = model_.bookmark_bar_node();
521 static const std::string model_string("a 1:[ b c ] d 2:[ e f g ] h "); 537 static const std::string model_string("a 1:[ b c ] d 2:[ e f g ] h ");
522 model_test_utils::AddNodesFromModelString(model_, root, model_string); 538 model_test_utils::AddNodesFromModelString(model_, root, model_string);
523 539
524 // Validate initial model. 540 // Validate initial model.
525 std::string actualModelString = model_test_utils::ModelStringFromNode(root); 541 std::string actualModelString = model_test_utils::ModelStringFromNode(root);
526 EXPECT_EQ(model_string, actualModelString); 542 EXPECT_EQ(model_string, actualModelString);
527 543
528 // Copy 'd' to be after '1:b': URL item from bar to folder. 544 // Copy 'd' to be after '1:b': URL item from bar to folder.
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1129
1114 EXPECT_TRUE(node.DeleteMetaInfo("key1")); 1130 EXPECT_TRUE(node.DeleteMetaInfo("key1"));
1115 EXPECT_TRUE(node.DeleteMetaInfo("key2")); 1131 EXPECT_TRUE(node.DeleteMetaInfo("key2"));
1116 EXPECT_FALSE(node.DeleteMetaInfo("key3")); 1132 EXPECT_FALSE(node.DeleteMetaInfo("key3"));
1117 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value)); 1133 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value));
1118 EXPECT_FALSE(node.GetMetaInfo("key2", &out_value)); 1134 EXPECT_FALSE(node.GetMetaInfo("key2", &out_value));
1119 EXPECT_TRUE(node.meta_info_str().empty()); 1135 EXPECT_TRUE(node.meta_info_str().empty());
1120 } 1136 }
1121 1137
1122 } // namespace 1138 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698