1 // Copyright (c) 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 "base/basictypes.h" 6 #include "base/strings/utf_string_conversions.h" 7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "url/gurl.h" 9 10 namespace internal { 11 12 // Defined in searchbox_extension.cc 13 GURL ResolveURL(const GURL& current_url, 14 const base::string16& possibly_relative_url); 15 16 TEST(SearchboxExtensionTest, ResolveURL) { 17 EXPECT_EQ(GURL("http://www.google.com/"), 18 ResolveURL(GURL(""), base::ASCIIToUTF16("http://www.google.com"))); 19 20 EXPECT_EQ(GURL("http://news.google.com/"), 21 ResolveURL(GURL("http://www.google.com"), 22 base::ASCIIToUTF16("http://news.google.com"))); 23 24 EXPECT_EQ(GURL("http://www.google.com/hello?q=world"), 25 ResolveURL(GURL("http://www.google.com/foo?a=b"), 26 base::ASCIIToUTF16("hello?q=world"))); 27 28 EXPECT_EQ(GURL("http://www.google.com:90/foo/hello?q=world"), 29 ResolveURL(GURL("http://www.google.com:90/"), 30 base::ASCIIToUTF16("foo/hello?q=world"))); 31 } 32 33 } // namespace internal 34