• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
12 class GURL;
13 
14 namespace base {
15 class Time;
16 }
17 
18 namespace content {
19 class PageState;
20 struct Referrer;
21 }
22 
23 namespace sessions {
24 
25 class SerializedNavigationEntry;
26 
27 // Set of test functions to manipulate a SerializedNavigationEntry.
28 class SerializedNavigationEntryTestHelper {
29  public:
30   // Compares the two entries. This uses EXPECT_XXX on each member, if your test
31   // needs to stop after this wrap calls to this in EXPECT_NO_FATAL_FAILURE.
32   static void ExpectNavigationEquals(const SerializedNavigationEntry& expected,
33                                      const SerializedNavigationEntry& actual);
34 
35   // Create a SerializedNavigationEntry with the given URL and title and some
36   // common values for the other fields.
37   static SerializedNavigationEntry CreateNavigation(
38       const std::string& virtual_url,
39       const std::string& title);
40 
41   static void SetPageState(const content::PageState& page_state,
42                            SerializedNavigationEntry* navigation);
43 
44   static void SetHasPostData(bool has_post_data,
45                              SerializedNavigationEntry* navigation);
46 
47   static void SetOriginalRequestURL(const GURL& original_request_url,
48                                     SerializedNavigationEntry* navigation);
49 
50   static void SetIsOverridingUserAgent(bool is_overriding_user_agent,
51                                        SerializedNavigationEntry* navigation);
52 
53   static void SetTimestamp(base::Time timestamp,
54                            SerializedNavigationEntry* navigation);
55 
56  private:
57   DISALLOW_IMPLICIT_CONSTRUCTORS(SerializedNavigationEntryTestHelper);
58 };
59 
60 }  // sessions
61 
62 #endif  // COMPONENTS_SESSIONS_SESSION_TYPES_TEST_HELPER_H_
63