chrome/browser/sessions/session_types_unittest.cc
// Create a TabNavigation, pickle it, then create another one by
// unpickling.  The new one should match the old one except for fields
// that aren't pickled, which should be set to default values.
Create a TabNavigation, pickle it, then create another one by
unpickling.  The new one should match the old one except for fields
that aren't pickled, which should be set to default values.
Create a TabNavigation pickle it then create another one by unpickling . The new one should match the old one except for fields that aren ' t pickled which should be set to default values .
TEST(TabNavigationTest, Pickle) {
  const TabNavigation& old_navigation =
      TabNavigation::FromNavigationEntry(kIndex, *MakeNavigationEntryForTest());
  Pickle pickle;
  old_navigation.WriteToPickle(&pickle);
  TabNavigation new_navigation;
  PickleIterator pickle_iterator(pickle);
  EXPECT_TRUE(new_navigation.ReadFromPickle(&pickle_iterator));
  EXPECT_EQ(kIndex, new_navigation.index());
  EXPECT_EQ(0, new_navigation.unique_id());
  EXPECT_EQ(kReferrer.url,
            SessionTypesTestHelper::GetReferrer(new_navigation).url);
  EXPECT_EQ(kReferrer.policy,
            SessionTypesTestHelper::GetReferrer(new_navigation).policy);
  EXPECT_EQ(kVirtualURL, new_navigation.virtual_url());
  EXPECT_EQ(kTitle, new_navigation.title());
  EXPECT_TRUE(new_navigation.content_state().empty());
  EXPECT_EQ(kTransitionType,
            SessionTypesTestHelper::GetTransitionType(new_navigation));
  EXPECT_EQ(kHasPostData,
            SessionTypesTestHelper::GetHasPostData(new_navigation));
  EXPECT_EQ(-1, SessionTypesTestHelper::GetPostID(new_navigation));
  EXPECT_EQ(kOriginalRequestURL,
            SessionTypesTestHelper::GetOriginalRequestURL(new_navigation));
  EXPECT_EQ(kIsOverridingUserAgent,
            SessionTypesTestHelper::GetIsOverridingUserAgent(new_navigation));
  EXPECT_EQ(kTimestamp, SessionTypesTestHelper::GetTimestamp(new_navigation));
}
TEST ( TabNavigationTest , Pickle ) { const TabNavigation & old_navigation = TabNavigation :: FromNavigationEntry ( kIndex , * MakeNavigationEntryForTest ( ) ) ; Pickle pickle ; old_navigation . WriteToPickle ( & pickle ) ; TabNavigation new_navigation ; PickleIterator pickle_iterator ( pickle ) ; EXPECT_TRUE ( new_navigation . ReadFromPickle ( & pickle_iterator ) ) ; EXPECT_EQ ( kIndex , new_navigation . index ( ) ) ; EXPECT_EQ ( 0 , new_navigation . unique_id ( ) ) ; EXPECT_EQ ( kReferrer . url , SessionTypesTestHelper :: GetReferrer ( new_navigation ) . url ) ; EXPECT_EQ ( kReferrer . policy , SessionTypesTestHelper :: GetReferrer ( new_navigation ) . policy ) ; EXPECT_EQ ( kVirtualURL , new_navigation . virtual_url ( ) ) ; EXPECT_EQ ( kTitle , new_navigation . title ( ) ) ; EXPECT_TRUE ( new_navigation . content_state ( ) . empty ( ) ) ; EXPECT_EQ ( kTransitionType , SessionTypesTestHelper :: GetTransitionType ( new_navigation ) ) ; EXPECT_EQ ( kHasPostData , SessionTypesTestHelper :: GetHasPostData ( new_navigation ) ) ; EXPECT_EQ ( -1 , SessionTypesTestHelper :: GetPostID ( new_navigation ) ) ; EXPECT_EQ ( kOriginalRequestURL , SessionTypesTestHelper :: GetOriginalRequestURL ( new_navigation ) ) ; EXPECT_EQ ( kIsOverridingUserAgent , SessionTypesTestHelper :: GetIsOverridingUserAgent ( new_navigation ) ) ; EXPECT_EQ ( kTimestamp , SessionTypesTestHelper :: GetTimestamp ( new_navigation ) ) ; }
Create a TabNavigation, pickle it, then create another one by
unpickling.
Create a TabNavigation pickle it then create another one by unpickling .