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 <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 Loading... |
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 Loading... |
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 |
OLD | NEW |