no_state_prefetch_utils_unittest.cc 1.3 KB

12345678910111213141516171819202122232425262728293031
  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
  3. // found in the LICENSE file.
  4. #include "components/no_state_prefetch/browser/no_state_prefetch_utils.h"
  5. #include "testing/gtest/include/gtest/gtest.h"
  6. #include "url/gurl.h"
  7. namespace prerender {
  8. // Ensure that we detect GWS origin URLs correctly.
  9. TEST(NoStatePrefetchUtilsTest, DetectGWSOriginURLTest) {
  10. EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/#asdf")));
  11. EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/")));
  12. EXPECT_TRUE(IsGoogleOriginURL(GURL("https://www.google.com")));
  13. EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/?a=b")));
  14. EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com/search?q=hi")));
  15. EXPECT_TRUE(IsGoogleOriginURL(GURL("http://google.com")));
  16. EXPECT_TRUE(IsGoogleOriginURL(GURL("http://WWW.GooGLE.CoM")));
  17. EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.co.uk")));
  18. // Non-standard ports are allowed for integration tests with the embedded
  19. // server.
  20. EXPECT_TRUE(IsGoogleOriginURL(GURL("http://www.google.com:42/")));
  21. EXPECT_FALSE(IsGoogleOriginURL(GURL("http://news.google.com")));
  22. EXPECT_FALSE(IsGoogleOriginURL(GURL("http://www.chromium.org")));
  23. EXPECT_FALSE(IsGoogleOriginURL(GURL("what://www.google.com")));
  24. }
  25. } // namespace prerender