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

Unified Diff: chrome/browser/sessions/session_types_test_helper.cc

Issue 10917231: Revamp TabNavigation class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sessions/session_types_test_helper.cc
diff --git a/chrome/browser/sessions/session_types_test_helper.cc b/chrome/browser/sessions/session_types_test_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f2201e425cd02f2062e29803c68f4d21188f8e67
--- /dev/null
+++ b/chrome/browser/sessions/session_types_test_helper.cc
@@ -0,0 +1,92 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+#include "chrome/browser/sessions/session_types_test_helper.h"
+
+#include "base/basictypes.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/sessions/session_types.h"
+#include "googleurl/src/gurl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h"
+
+void SessionTypesTestHelper::ExpectNavigationEquals(
+ const TabNavigation& expected,
+ const TabNavigation& actual) {
+ EXPECT_EQ(expected.referrer_.url, actual.referrer_.url);
+ EXPECT_EQ(expected.referrer_.policy, actual.referrer_.policy);
+ EXPECT_EQ(expected.virtual_url_, actual.virtual_url_);
+ EXPECT_EQ(expected.title_, actual.title_);
+ EXPECT_EQ(expected.content_state_, actual.content_state_);
+ EXPECT_EQ(expected.transition_type_, actual.transition_type_);
+ EXPECT_EQ(expected.has_post_data_, actual.has_post_data_);
+ EXPECT_EQ(expected.original_request_url_, actual.original_request_url_);
+ EXPECT_EQ(expected.is_overriding_user_agent_,
+ actual.is_overriding_user_agent_);
+}
+
+TabNavigation SessionTypesTestHelper::CreateNavigation(
+ const std::string& virtual_url,
+ const std::string& title) {
+ TabNavigation navigation;
+ navigation.index_ = 0;
+ navigation.referrer_ =
+ content::Referrer(GURL("http://www.referrer.com"),
+ WebKit::WebReferrerPolicyDefault);
+ navigation.virtual_url_ = GURL(virtual_url);
+ navigation.title_ = UTF8ToUTF16(title);
+ navigation.content_state_ = "fake_state";
+ navigation.timestamp_ = base::Time::Now();
+ return navigation;
+}
+
+const content::Referrer& SessionTypesTestHelper::GetReferrer(
+ const TabNavigation& navigation) {
+ return navigation.referrer_;
+}
+
+content::PageTransition SessionTypesTestHelper::GetTransitionType(
+ const TabNavigation& navigation) {
+ return navigation.transition_type_;
+}
+
+bool SessionTypesTestHelper::GetHasPostData(const TabNavigation& navigation) {
+ return navigation.has_post_data_;
+}
+
+int64 SessionTypesTestHelper::GetPostID(const TabNavigation& navigation) {
+ return navigation.post_id_;
+}
+
+const GURL& SessionTypesTestHelper::GetOriginalRequestURL(
+ const TabNavigation& navigation) {
+ return navigation.original_request_url_;
+}
+
+bool SessionTypesTestHelper::GetIsOverridingUserAgent(
+ const TabNavigation& navigation) {
+ return navigation.is_overriding_user_agent_;
+}
+
+void SessionTypesTestHelper::SetContentState(
+ TabNavigation* navigation,
+ const std::string& content_state) {
+ navigation->content_state_ = content_state;
+}
+
+void SessionTypesTestHelper::SetHasPostData(TabNavigation* navigation,
+ bool has_post_data) {
+ navigation->has_post_data_ = has_post_data;
+}
+
+void SessionTypesTestHelper::SetOriginalRequestURL(
+ TabNavigation* navigation,
+ const GURL& original_request_url) {
+ navigation->original_request_url_ = original_request_url;
+}
+
+void SessionTypesTestHelper::SetIsOverridingUserAgent(
+ TabNavigation* navigation,
+ bool is_overriding_user_agent) {
+ navigation->is_overriding_user_agent_ = is_overriding_user_agent;
+}
« no previous file with comments | « chrome/browser/sessions/session_types_test_helper.h ('k') | chrome/browser/sessions/session_types_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698