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