| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/prerender/prerender_util.h" | 5 #include "chrome/browser/prerender/prerender_util.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
| 9 | 9 |
| 10 namespace prerender { | 10 namespace prerender { |
| 11 | 11 |
| 12 // Ensure that we detect GWS origin URLs correctly. | 12 // Ensure that we detect GWS origin URLs correctly. |
| 13 TEST(PrerenderUtilTest, DetectGWSOriginURLTest) { | 13 TEST(PrerenderUtilTest, DetectGWSOriginURLTest) { |
| 14 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/#asdf"))); | 14 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/#asdf"))); |
| 15 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/"))); | 15 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/"))); |
| 16 EXPECT_TRUE(IsGoogleOriginURL(GURL("https://www.google.com"))); | 16 EXPECT_TRUE(IsGoogleOriginURL(GURL("https://www.google.com"))); |
| 17 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/?a=b"))); | 17 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/?a=b"))); |
| 18 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/search?q=hi"))); | 18 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/search?q=hi"))); |
| 19 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://google.com"))); | 19 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://google.com"))); |
| 20 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://WWW.GooGLE.CoM"))); | 20 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://WWW.GooGLE.CoM"))); |
| 21 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.co.uk"))); | 21 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.co.uk"))); |
| 22 // Non-standard ports are allowed for integration tests with the embedded | |
| 23 // server. | |
| 24 EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com:42/"))); | |
| 25 | 22 |
| 23 EXPECT_FALSE(IsGoogleOriginURL(GURL("http://www.google.com:42/"))); |
| 26 EXPECT_FALSE(IsGoogleOriginURL(GURL("http://news.google.com"))); | 24 EXPECT_FALSE(IsGoogleOriginURL(GURL("http://news.google.com"))); |
| 27 EXPECT_FALSE(IsGoogleOriginURL(GURL("http://www.chromium.org"))); | 25 EXPECT_FALSE(IsGoogleOriginURL(GURL("http://www.chromium.org"))); |
| 28 EXPECT_FALSE(IsGoogleOriginURL(GURL("what://www.google.com"))); | 26 EXPECT_FALSE(IsGoogleOriginURL(GURL("what://www.google.com"))); |
| 29 } | 27 } |
| 30 | 28 |
| 31 } // namespace prerender | 29 } // namespace prerender |
| OLD | NEW |