Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: components/sessions/serialized_navigation_entry_test_helper.cc

Issue 14497003: Moves TabNavigation into components/sessions and renames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really remove webkit_support Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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 #include "chrome/browser/sessions/session_types_test_helper.h"
5 4
6 #include "base/basictypes.h" 5 #include "components/sessions/serialized_navigation_entry_test_helper.h"
6
7 #include "base/time.h"
7 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/sessions/session_types.h" 9 #include "components/sessions/serialized_navigation_entry.h"
9 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h " 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h "
12 13
13 void SessionTypesTestHelper::ExpectNavigationEquals( 14 namespace sessions {
14 const TabNavigation& expected, 15
15 const TabNavigation& actual) { 16 // static
17 void SerializedNavigationEntryTestHelper::ExpectNavigationEquals(
18 const SerializedNavigationEntry& expected,
19 const SerializedNavigationEntry& actual) {
16 EXPECT_EQ(expected.referrer_.url, actual.referrer_.url); 20 EXPECT_EQ(expected.referrer_.url, actual.referrer_.url);
17 EXPECT_EQ(expected.referrer_.policy, actual.referrer_.policy); 21 EXPECT_EQ(expected.referrer_.policy, actual.referrer_.policy);
18 EXPECT_EQ(expected.virtual_url_, actual.virtual_url_); 22 EXPECT_EQ(expected.virtual_url_, actual.virtual_url_);
19 EXPECT_EQ(expected.title_, actual.title_); 23 EXPECT_EQ(expected.title_, actual.title_);
20 EXPECT_EQ(expected.content_state_, actual.content_state_); 24 EXPECT_EQ(expected.content_state_, actual.content_state_);
21 EXPECT_EQ(expected.transition_type_, actual.transition_type_); 25 EXPECT_EQ(expected.transition_type_, actual.transition_type_);
22 EXPECT_EQ(expected.has_post_data_, actual.has_post_data_); 26 EXPECT_EQ(expected.has_post_data_, actual.has_post_data_);
23 EXPECT_EQ(expected.original_request_url_, actual.original_request_url_); 27 EXPECT_EQ(expected.original_request_url_, actual.original_request_url_);
24 EXPECT_EQ(expected.is_overriding_user_agent_, 28 EXPECT_EQ(expected.is_overriding_user_agent_,
25 actual.is_overriding_user_agent_); 29 actual.is_overriding_user_agent_);
26 } 30 }
27 31
28 TabNavigation SessionTypesTestHelper::CreateNavigation( 32 // static
33 SerializedNavigationEntry SerializedNavigationEntryTestHelper::CreateNavigation(
29 const std::string& virtual_url, 34 const std::string& virtual_url,
30 const std::string& title) { 35 const std::string& title) {
31 TabNavigation navigation; 36 SerializedNavigationEntry navigation;
32 navigation.index_ = 0; 37 navigation.index_ = 0;
33 navigation.referrer_ = 38 navigation.referrer_ =
34 content::Referrer(GURL("http://www.referrer.com"), 39 content::Referrer(GURL("http://www.referrer.com"),
35 WebKit::WebReferrerPolicyDefault); 40 WebKit::WebReferrerPolicyDefault);
36 navigation.virtual_url_ = GURL(virtual_url); 41 navigation.virtual_url_ = GURL(virtual_url);
37 navigation.title_ = UTF8ToUTF16(title); 42 navigation.title_ = UTF8ToUTF16(title);
38 navigation.content_state_ = "fake_state"; 43 navigation.content_state_ = "fake_state";
39 navigation.timestamp_ = base::Time::Now(); 44 navigation.timestamp_ = base::Time::Now();
40 return navigation; 45 return navigation;
41 } 46 }
42 47
43 const content::Referrer& SessionTypesTestHelper::GetReferrer( 48 // static
44 const TabNavigation& navigation) { 49 void SerializedNavigationEntryTestHelper::SetContentState(
45 return navigation.referrer_; 50 const std::string& content_state,
46 } 51 SerializedNavigationEntry* navigation) {
47
48 content::PageTransition SessionTypesTestHelper::GetTransitionType(
49 const TabNavigation& navigation) {
50 return navigation.transition_type_;
51 }
52
53 bool SessionTypesTestHelper::GetHasPostData(const TabNavigation& navigation) {
54 return navigation.has_post_data_;
55 }
56
57 int64 SessionTypesTestHelper::GetPostID(const TabNavigation& navigation) {
58 return navigation.post_id_;
59 }
60
61 const GURL& SessionTypesTestHelper::GetOriginalRequestURL(
62 const TabNavigation& navigation) {
63 return navigation.original_request_url_;
64 }
65
66 bool SessionTypesTestHelper::GetIsOverridingUserAgent(
67 const TabNavigation& navigation) {
68 return navigation.is_overriding_user_agent_;
69 }
70
71 base::Time SessionTypesTestHelper::GetTimestamp(
72 const TabNavigation& navigation) {
73 return navigation.timestamp_;
74 }
75
76 void SessionTypesTestHelper::SetContentState(
77 TabNavigation* navigation,
78 const std::string& content_state) {
79 navigation->content_state_ = content_state; 52 navigation->content_state_ = content_state;
80 } 53 }
81 54
82 void SessionTypesTestHelper::SetHasPostData(TabNavigation* navigation, 55 // static
83 bool has_post_data) { 56 void SerializedNavigationEntryTestHelper::SetHasPostData(
57 bool has_post_data,
58 SerializedNavigationEntry* navigation) {
84 navigation->has_post_data_ = has_post_data; 59 navigation->has_post_data_ = has_post_data;
85 } 60 }
86 61
87 void SessionTypesTestHelper::SetOriginalRequestURL( 62 // static
88 TabNavigation* navigation, 63 void SerializedNavigationEntryTestHelper::SetOriginalRequestURL(
89 const GURL& original_request_url) { 64 const GURL& original_request_url,
65 SerializedNavigationEntry* navigation) {
90 navigation->original_request_url_ = original_request_url; 66 navigation->original_request_url_ = original_request_url;
91 } 67 }
92 68
93 void SessionTypesTestHelper::SetIsOverridingUserAgent( 69 // static
94 TabNavigation* navigation, 70 void SerializedNavigationEntryTestHelper::SetIsOverridingUserAgent(
95 bool is_overriding_user_agent) { 71 bool is_overriding_user_agent,
72 SerializedNavigationEntry* navigation) {
96 navigation->is_overriding_user_agent_ = is_overriding_user_agent; 73 navigation->is_overriding_user_agent_ = is_overriding_user_agent;
97 } 74 }
98 75
99 void SessionTypesTestHelper::SetTimestamp( 76 // static
100 TabNavigation* navigation, 77 void SerializedNavigationEntryTestHelper::SetTimestamp(
101 base::Time timestamp) { 78 base::Time timestamp,
79 SerializedNavigationEntry* navigation) {
102 navigation->timestamp_ = timestamp; 80 navigation->timestamp_ = timestamp;
103 } 81 }
82
83 } // namespace sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698