1// Copyright 2013 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 5#include "chrome/common/search_urls.h" 6 7#include "testing/gtest/include/gtest/gtest.h" 8#include "url/gurl.h" 9 10namespace search { 11typedef testing::Test SearchURLsTest; 12 13TEST_F(SearchURLsTest, MatchesOriginAndPath) { 14 EXPECT_TRUE(MatchesOriginAndPath( 15 GURL("http://example.com/path"), 16 GURL("http://example.com/path?param"))); 17 EXPECT_FALSE(MatchesOriginAndPath( 18 GURL("http://not.example.com/path"), 19 GURL("http://example.com/path"))); 20 EXPECT_TRUE(MatchesOriginAndPath( 21 GURL("http://example.com:80/path"), 22 GURL("http://example.com/path"))); 23 EXPECT_FALSE(MatchesOriginAndPath( 24 GURL("http://example.com:8080/path"), 25 GURL("http://example.com/path"))); 26 EXPECT_FALSE(MatchesOriginAndPath( 27 GURL("ftp://example.com/path"), 28 GURL("http://example.com/path"))); 29 EXPECT_FALSE(MatchesOriginAndPath( 30 GURL("http://example.com/path"), 31 GURL("https://example.com/path"))); 32 EXPECT_TRUE(MatchesOriginAndPath( 33 GURL("https://example.com/path"), 34 GURL("http://example.com/path"))); 35 EXPECT_FALSE(MatchesOriginAndPath( 36 GURL("http://example.com/path"), 37 GURL("http://example.com/another-path"))); 38} 39 40} // namespace search 41