14e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 24e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 34e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// found in the LICENSE file. 44e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 54e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "chrome/common/search_urls.h" 64e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 74e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "testing/gtest/include/gtest/gtest.h" 84e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "url/gurl.h" 94e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)namespace search { 114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)typedef testing::Test SearchURLsTest; 124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)TEST_F(SearchURLsTest, MatchesOriginAndPath) { 144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) EXPECT_TRUE(MatchesOriginAndPath( 154e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path"), 164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path?param"))); 174e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) EXPECT_FALSE(MatchesOriginAndPath( 184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://not.example.com/path"), 194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path"))); 204e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) EXPECT_TRUE(MatchesOriginAndPath( 214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com:80/path"), 224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path"))); 234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) EXPECT_FALSE(MatchesOriginAndPath( 244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com:8080/path"), 254e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path"))); 264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) EXPECT_FALSE(MatchesOriginAndPath( 274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("ftp://example.com/path"), 284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path"))); 294e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) EXPECT_FALSE(MatchesOriginAndPath( 304e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path"), 314e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("https://example.com/path"))); 324e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) EXPECT_TRUE(MatchesOriginAndPath( 334e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("https://example.com/path"), 344e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path"))); 354e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) EXPECT_FALSE(MatchesOriginAndPath( 364e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/path"), 374e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) GURL("http://example.com/another-path"))); 384e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} 394e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 404e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)} // namespace search 41