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 |