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

Side by Side Diff: chrome/browser/prerender/prerender_util_unittest.cc

Issue 2649903003: [Prerender] Disallow non-standard ports for Google URLs
Patch Set: cleanup Created 3 years, 11 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
« no previous file with comments | « chrome/browser/prerender/prerender_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698