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 // TODO(akalin): This file is basically just a unit test for | 5 // TODO(akalin): This file is basically just a unit test for |
6 // BookmarkChangeProcessor. Write unit tests for | 6 // BookmarkChangeProcessor. Write unit tests for |
7 // BookmarkModelAssociator separately. | 7 // BookmarkModelAssociator separately. |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <vector> | 10 #include <vector> |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 int64 other_bookmarks_id() { | 536 int64 other_bookmarks_id() { |
537 return | 537 return |
538 model_associator_->GetSyncIdFromChromeId(model_->other_node()->id()); | 538 model_associator_->GetSyncIdFromChromeId(model_->other_node()->id()); |
539 } | 539 } |
540 | 540 |
541 int64 bookmark_bar_id() { | 541 int64 bookmark_bar_id() { |
542 return model_associator_->GetSyncIdFromChromeId( | 542 return model_associator_->GetSyncIdFromChromeId( |
543 model_->bookmark_bar_node()->id()); | 543 model_->bookmark_bar_node()->id()); |
544 } | 544 } |
545 | 545 |
546 int64 GetSyncIdFromChromeNode(const BookmarkNode* node) { | |
547 return model_associator_->GetSyncIdFromChromeId(node->id()); | |
548 } | |
549 | |
550 private: | 546 private: |
551 // Used by both |ui_thread_| and |file_thread_|. | 547 // Used by both |ui_thread_| and |file_thread_|. |
552 MessageLoop message_loop_; | 548 MessageLoop message_loop_; |
553 content::TestBrowserThread ui_thread_; | 549 content::TestBrowserThread ui_thread_; |
554 // Needed by |model_|. | 550 // Needed by |model_|. |
555 content::TestBrowserThread file_thread_; | 551 content::TestBrowserThread file_thread_; |
556 | 552 |
557 TestingProfile profile_; | 553 TestingProfile profile_; |
558 scoped_ptr<TestBookmarkModelAssociator> model_associator_; | 554 scoped_ptr<TestBookmarkModelAssociator> model_associator_; |
559 | 555 |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 | 1488 |
1493 StartSync(); | 1489 StartSync(); |
1494 | 1490 |
1495 EXPECT_EQ(1, observer.get_started()); | 1491 EXPECT_EQ(1, observer.get_started()); |
1496 EXPECT_EQ(0, observer.get_completed_count_at_started()); | 1492 EXPECT_EQ(0, observer.get_completed_count_at_started()); |
1497 EXPECT_EQ(1, observer.get_completed()); | 1493 EXPECT_EQ(1, observer.get_completed()); |
1498 | 1494 |
1499 model_->RemoveObserver(&observer); | 1495 model_->RemoveObserver(&observer); |
1500 } | 1496 } |
1501 | 1497 |
1502 TEST_F(ProfileSyncServiceBookmarkTest, FaviconUpdateToDeletedBookmark) { | |
1503 LoadBookmarkModel(DELETE_EXISTING_STORAGE, DONT_SAVE_TO_STORAGE); | |
1504 const BookmarkNode* bnode = model_->AddURL( | |
1505 model_->bookmark_bar_node(), | |
1506 0, | |
1507 ASCIIToUTF16("Internets #1 Pies Site"), | |
1508 GURL("http://www.easypie.com/")); | |
1509 StartSync(); | |
1510 | |
1511 { | |
1512 syncer::WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); | |
1513 FakeServerChange dels(&trans); | |
1514 dels.Delete(GetSyncIdFromChromeNode(bnode)); | |
1515 dels.ApplyPendingChanges(change_processor_.get()); | |
1516 } | |
1517 | |
1518 // Now update the favicon locally. This should have no effect, but should | |
1519 // not result in an error either. | |
1520 change_processor_->BookmarkNodeFaviconChanged(model_, bnode); | |
1521 } | |
1522 | |
1523 } // namespace | 1498 } // namespace |
1524 | 1499 |
1525 } // namespace browser_sync | 1500 } // namespace browser_sync |
OLD | NEW |