chrome/browser/sessions/session_types_unittest.cc
// Create a NavigationEntry, convert it to a TabNavigation, then
// create a sync protocol buffer from it.  The protocol buffer should
// have matching fields to the NavigationEntry (when applicable).
Create a NavigationEntry, convert it to a TabNavigation, then
create a sync protocol buffer from it.  The protocol buffer should
have matching fields to the NavigationEntry (when applicable).
Create a NavigationEntry convert it to a TabNavigation then create a sync protocol buffer from it . The protocol buffer should have matching fields to the NavigationEntry ( when applicable ) .
TEST(TabNavigationTest, ToSyncData) {
  const scoped_ptr<content::NavigationEntry> navigation_entry(
      MakeNavigationEntryForTest());
  const TabNavigation& navigation =
      TabNavigation::FromNavigationEntry(kIndex, *navigation_entry);
  const sync_pb::TabNavigation sync_data = navigation.ToSyncData();
  EXPECT_EQ(kVirtualURL.spec(), sync_data.virtual_url());
  EXPECT_EQ(kReferrer.url.spec(), sync_data.referrer());
  EXPECT_EQ(kTitle, ASCIIToUTF16(sync_data.title()));
  EXPECT_TRUE(sync_data.state().empty());
  EXPECT_EQ(sync_pb::SyncEnums_PageTransition_AUTO_SUBFRAME,
            sync_data.page_transition());
  EXPECT_TRUE(sync_data.has_redirect_type());
  EXPECT_EQ(navigation_entry->GetUniqueID(), sync_data.unique_id());
  EXPECT_EQ(syncer::TimeToProtoTime(kTimestamp), sync_data.timestamp());
  EXPECT_EQ(kTimestamp.ToInternalValue(), sync_data.global_id());
}
TEST ( TabNavigationTest , ToSyncData ) { const scoped_ptr < content :: NavigationEntry > navigation_entry ( MakeNavigationEntryForTest ( ) ) ; const TabNavigation & navigation = TabNavigation :: FromNavigationEntry ( kIndex , * navigation_entry ) ; const sync_pb :: TabNavigation sync_data = navigation . ToSyncData ( ) ; EXPECT_EQ ( kVirtualURL . spec ( ) , sync_data . virtual_url ( ) ) ; EXPECT_EQ ( kReferrer . url . spec ( ) , sync_data . referrer ( ) ) ; EXPECT_EQ ( kTitle , ASCIIToUTF16 ( sync_data . title ( ) ) ) ; EXPECT_TRUE ( sync_data . state ( ) . empty ( ) ) ; EXPECT_EQ ( sync_pb :: SyncEnums_PageTransition_AUTO_SUBFRAME , sync_data . page_transition ( ) ) ; EXPECT_TRUE ( sync_data . has_redirect_type ( ) ) ; EXPECT_EQ ( navigation_entry -> GetUniqueID ( ) , sync_data . unique_id ( ) ) ; EXPECT_EQ ( syncer :: TimeToProtoTime ( kTimestamp ) , sync_data . timestamp ( ) ) ; EXPECT_EQ ( kTimestamp . ToInternalValue ( ) , sync_data . global_id ( ) ) ; }
Create a NavigationEntry, convert it to a TabNavigation, then
create a sync protocol buffer from it.
Create a NavigationEntry convert it to a TabNavigation then create a sync protocol buffer from it .