1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_SESSIONS_SESSION_TYPES_TEST_HELPER_H_ 6 #define COMPONENTS_SESSIONS_SESSION_TYPES_TEST_HELPER_H_ 7 8 #include <string> 9 10 #include "base/basictypes.h" 11 #include "content/public/common/page_transition_types.h" 12 13 class GURL; 14 15 namespace base { 16 class Time; 17 } 18 19 namespace content { 20 class PageState; 21 struct Referrer; 22 } 23 24 namespace sessions { 25 26 class SerializedNavigationEntry; 27 28 // Set of test functions to manipulate a SerializedNavigationEntry. 29 class SerializedNavigationEntryTestHelper { 30 public: 31 // Compares the two entries. This uses EXPECT_XXX on each member, if your test 32 // needs to stop after this wrap calls to this in EXPECT_NO_FATAL_FAILURE. 33 static void ExpectNavigationEquals(const SerializedNavigationEntry& expected, 34 const SerializedNavigationEntry& actual); 35 36 // Create a SerializedNavigationEntry with the given URL and title and some 37 // common values for the other fields. 38 static SerializedNavigationEntry CreateNavigation( 39 const std::string& virtual_url, 40 const std::string& title); 41 42 static void SetPageState(const content::PageState& page_state, 43 SerializedNavigationEntry* navigation); 44 45 static void SetHasPostData(bool has_post_data, 46 SerializedNavigationEntry* navigation); 47 48 static void SetOriginalRequestURL(const GURL& original_request_url, 49 SerializedNavigationEntry* navigation); 50 51 static void SetIsOverridingUserAgent(bool is_overriding_user_agent, 52 SerializedNavigationEntry* navigation); 53 54 static void SetTimestamp(base::Time timestamp, 55 SerializedNavigationEntry* navigation); 56 57 private: 58 DISALLOW_IMPLICIT_CONSTRUCTORS(SerializedNavigationEntryTestHelper); 59 }; 60 61 } // sessions 62 63 #endif // COMPONENTS_SESSIONS_SESSION_TYPES_TEST_HELPER_H_ 64