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

Side by Side Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 11413153: Remove legacy GetURL(),SetURL(),GetFaviconBytes(),SetFaviconBytes() (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 | « sync/internal_api/public/write_node.h ('k') | sync/internal_api/write_node.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 (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 // Unit tests for the SyncApi. Note that a lot of the underlying 5 // Unit tests for the SyncApi. Note that a lot of the underlying
6 // functionality is provided by the Syncable layer, which has its own 6 // functionality is provided by the Syncable layer, which has its own
7 // unit tests. We'll test SyncApi specific things in this harness. 7 // unit tests. We'll test SyncApi specific things in this harness.
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 EXPECT_EQ(title2, node2.GetBookmarkSpecifics().title()); 2116 EXPECT_EQ(title2, node2.GetBookmarkSpecifics().title());
2117 EXPECT_EQ(url2, node2.GetBookmarkSpecifics().url()); 2117 EXPECT_EQ(url2, node2.GetBookmarkSpecifics().url());
2118 } 2118 }
2119 } 2119 }
2120 2120
2121 // Create a bookmark and set the title/url, then verify the data was properly 2121 // Create a bookmark and set the title/url, then verify the data was properly
2122 // set. This replicates the unique way bookmarks have of creating sync nodes. 2122 // set. This replicates the unique way bookmarks have of creating sync nodes.
2123 // See BookmarkChangeProcessor::PlaceSyncNode(..). 2123 // See BookmarkChangeProcessor::PlaceSyncNode(..).
2124 TEST_F(SyncManagerTest, CreateLocalBookmark) { 2124 TEST_F(SyncManagerTest, CreateLocalBookmark) {
2125 std::string title = "title"; 2125 std::string title = "title";
2126 GURL url("url"); 2126 std::string url = "url";
2127 { 2127 {
2128 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 2128 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
2129 ReadNode root_node(&trans); 2129 ReadNode root_node(&trans);
2130 root_node.InitByRootLookup(); 2130 root_node.InitByRootLookup();
2131 WriteNode node(&trans); 2131 WriteNode node(&trans);
2132 ASSERT_TRUE(node.InitByCreation(BOOKMARKS, root_node, NULL)); 2132 ASSERT_TRUE(node.InitByCreation(BOOKMARKS, root_node, NULL));
2133 node.SetIsFolder(false); 2133 node.SetIsFolder(false);
2134 node.SetTitle(UTF8ToWide(title)); 2134 node.SetTitle(UTF8ToWide(title));
2135 node.SetURL(url); 2135
2136 sync_pb::BookmarkSpecifics bookmark_specifics(node.GetBookmarkSpecifics());
2137 bookmark_specifics.set_url(url);
2138 node.SetBookmarkSpecifics(bookmark_specifics);
2136 } 2139 }
2137 { 2140 {
2138 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 2141 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
2139 ReadNode root_node(&trans); 2142 ReadNode root_node(&trans);
2140 root_node.InitByRootLookup(); 2143 root_node.InitByRootLookup();
2141 int64 child_id = root_node.GetFirstChildId(); 2144 int64 child_id = root_node.GetFirstChildId();
2142 2145
2143 ReadNode node(&trans); 2146 ReadNode node(&trans);
2144 ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id)); 2147 ASSERT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(child_id));
2145 EXPECT_FALSE(node.GetIsFolder()); 2148 EXPECT_FALSE(node.GetIsFolder());
2146 EXPECT_EQ(title, node.GetTitle()); 2149 EXPECT_EQ(title, node.GetTitle());
2147 EXPECT_EQ(url, node.GetURL()); 2150 EXPECT_EQ(url, node.GetBookmarkSpecifics().url());
2148 } 2151 }
2149 } 2152 }
2150 2153
2151 // Verifies WriteNode::UpdateEntryWithEncryption does not make unnecessary 2154 // Verifies WriteNode::UpdateEntryWithEncryption does not make unnecessary
2152 // changes. 2155 // changes.
2153 TEST_F(SyncManagerTest, UpdateEntryWithEncryption) { 2156 TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
2154 std::string client_tag = "title"; 2157 std::string client_tag = "title";
2155 sync_pb::EntitySpecifics entity_specifics; 2158 sync_pb::EntitySpecifics entity_specifics;
2156 entity_specifics.mutable_bookmark()->set_url("url"); 2159 entity_specifics.mutable_bookmark()->set_url("url");
2157 entity_specifics.mutable_bookmark()->set_title("title"); 2160 entity_specifics.mutable_bookmark()->set_title("title");
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 client_tag), 2665 client_tag),
2663 entity_specifics); 2666 entity_specifics);
2664 2667
2665 { 2668 {
2666 // Verify the data. 2669 // Verify the data.
2667 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 2670 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
2668 ReadNode node(&trans); 2671 ReadNode node(&trans);
2669 EXPECT_EQ(BaseNode::INIT_OK, 2672 EXPECT_EQ(BaseNode::INIT_OK,
2670 node.InitByClientTagLookup(BOOKMARKS, client_tag)); 2673 node.InitByClientTagLookup(BOOKMARKS, client_tag));
2671 EXPECT_EQ(title, node.GetTitle()); 2674 EXPECT_EQ(title, node.GetTitle());
2672 EXPECT_EQ(GURL(url), node.GetURL()); 2675 EXPECT_EQ(url, node.GetBookmarkSpecifics().url());
2673 } 2676 }
2674 2677
2675 { 2678 {
2676 // Overwrite the url (which overwrites the specifics). 2679 // Overwrite the url (which overwrites the specifics).
2677 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 2680 WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
2678 WriteNode node(&trans); 2681 WriteNode node(&trans);
2679 EXPECT_EQ(BaseNode::INIT_OK, 2682 EXPECT_EQ(BaseNode::INIT_OK,
2680 node.InitByClientTagLookup(BOOKMARKS, client_tag)); 2683 node.InitByClientTagLookup(BOOKMARKS, client_tag));
2681 node.SetURL(GURL(url2)); 2684
2685 sync_pb::BookmarkSpecifics bookmark_specifics(node.GetBookmarkSpecifics());
2686 bookmark_specifics.set_url(url2);
2687 node.SetBookmarkSpecifics(bookmark_specifics);
2682 } 2688 }
2683 2689
2684 { 2690 {
2685 // Verify it's still encrypted and it has the most recent url. 2691 // Verify it's still encrypted and it has the most recent url.
2686 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); 2692 ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
2687 ReadNode node(&trans); 2693 ReadNode node(&trans);
2688 EXPECT_EQ(BaseNode::INIT_OK, 2694 EXPECT_EQ(BaseNode::INIT_OK,
2689 node.InitByClientTagLookup(BOOKMARKS, client_tag)); 2695 node.InitByClientTagLookup(BOOKMARKS, client_tag));
2690 EXPECT_EQ(title, node.GetTitle()); 2696 EXPECT_EQ(title, node.GetTitle());
2691 EXPECT_EQ(GURL(url2), node.GetURL()); 2697 EXPECT_EQ(url2, node.GetBookmarkSpecifics().url());
2692 const syncable::Entry* node_entry = node.GetEntry(); 2698 const syncable::Entry* node_entry = node.GetEntry();
2693 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); 2699 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME));
2694 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); 2700 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS);
2695 EXPECT_TRUE(specifics.has_encrypted()); 2701 EXPECT_TRUE(specifics.has_encrypted());
2696 } 2702 }
2697 } 2703 }
2698 2704
2699 // Verify transaction version of a model type is incremented when node of 2705 // Verify transaction version of a model type is incremented when node of
2700 // that type is updated. 2706 // that type is updated.
2701 TEST_F(SyncManagerTest, IncrementTransactionVersion) { 2707 TEST_F(SyncManagerTest, IncrementTransactionVersion) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 3011
3006 // Verify only the non-disabled types remain after cleanup. 3012 // Verify only the non-disabled types remain after cleanup.
3007 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types); 3013 sync_manager_.PurgeDisabledTypes(enabled_types, new_enabled_types);
3008 EXPECT_TRUE(new_enabled_types.Equals( 3014 EXPECT_TRUE(new_enabled_types.Equals(
3009 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types))); 3015 Union(sync_manager_.InitialSyncEndedTypes(), partial_enabled_types)));
3010 EXPECT_TRUE(disabled_types.Equals( 3016 EXPECT_TRUE(disabled_types.Equals(
3011 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All()))); 3017 sync_manager_.GetTypesWithEmptyProgressMarkerToken(ModelTypeSet::All())));
3012 } 3018 }
3013 3019
3014 } // namespace 3020 } // namespace
OLDNEW
« no previous file with comments | « sync/internal_api/public/write_node.h ('k') | sync/internal_api/write_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698