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

Unified Diff: content/browser/tab_contents/referrer_unittest.cc

Issue 8635017: Add a referrer class to be used in the browser process whenever passing around referrsr (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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: content/browser/tab_contents/referrer_unittest.cc
diff --git a/content/browser/tab_contents/referrer_unittest.cc b/content/browser/tab_contents/referrer_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..476177def90b39967781f2080ef35f4134884179
--- /dev/null
+++ b/content/browser/tab_contents/referrer_unittest.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h"
+
+#include "content/browser/tab_contents/referrer.h"
+
+namespace {
+
+const char* kTestURL = "http://google.com/";
+
+// Check that copying Referrer objects works.
+TEST(ReferrerTest, Copy) {
+ content::Referrer r1(GURL(kTestURL), WebKit::WebReferrerPolicyAlways);
+ content::Referrer r2;
+
+ r2 = r1;
+ EXPECT_EQ(GURL(kTestURL), r2.referrer());
+ EXPECT_EQ(WebKit::WebReferrerPolicyAlways, r2.referrer_policy());
+}
+
+// Check that checking Referrer objects for equality works.
+TEST(ReferrerTest, Equality) {
+ content::Referrer r1(GURL(kTestURL), WebKit::WebReferrerPolicyAlways);
+ content::Referrer r2(GURL(kTestURL), WebKit::WebReferrerPolicyAlways);
+ content::Referrer r3(GURL(kTestURL), WebKit::WebReferrerPolicyOrigin);
+
+ EXPECT_EQ(r1, r2);
+ EXPECT_NE(r1, r3);
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698