[email protected] | b4abd7ff | 2013-05-02 16:32:34 | [diff] [blame] | 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 | |
[email protected] | c0bc3825 | 2013-05-08 17:52:17 | [diff] [blame] | 5 | #include "base/basictypes.h" |
[email protected] | abfd149 | 2013-06-07 21:23:26 | [diff] [blame] | 6 | #include "base/strings/utf_string_conversions.h" |
[email protected] | b4abd7ff | 2013-05-02 16:32:34 | [diff] [blame] | 7 | #include "testing/gtest/include/gtest/gtest.h" |
[email protected] | 5f5ef80 | 2013-07-04 16:11:13 | [diff] [blame] | 8 | #include "url/gurl.h" |
[email protected] | b4abd7ff | 2013-05-02 16:32:34 | [diff] [blame] | 9 | |
| 10 | namespace internal { |
| 11 | |
| 12 | // Defined in searchbox_extension.cc |
[email protected] | c0bc3825 | 2013-05-08 17:52:17 | [diff] [blame] | 13 | GURL ResolveURL(const GURL& current_url, const string16& possibly_relative_url); |
| 14 | |
| 15 | TEST(SearchboxExtensionTest, ResolveURL) { |
| 16 | EXPECT_EQ(GURL("http://www.google.com/"), |
| 17 | ResolveURL(GURL(""), ASCIIToUTF16("http://www.google.com"))); |
| 18 | |
| 19 | EXPECT_EQ(GURL("http://news.google.com/"), |
| 20 | ResolveURL(GURL("http://www.google.com"), |
| 21 | ASCIIToUTF16("http://news.google.com"))); |
| 22 | |
| 23 | EXPECT_EQ(GURL("http://www.google.com/hello?q=world"), |
| 24 | ResolveURL(GURL("http://www.google.com/foo?a=b"), |
| 25 | ASCIIToUTF16("hello?q=world"))); |
| 26 | |
| 27 | EXPECT_EQ(GURL("http://www.google.com:90/foo/hello?q=world"), |
| 28 | ResolveURL(GURL("http://www.google.com:90/"), |
| 29 | ASCIIToUTF16("foo/hello?q=world"))); |
| 30 | } |
| 31 | |
[email protected] | b4abd7ff | 2013-05-02 16:32:34 | [diff] [blame] | 32 | } // namespace internal |