OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
9 | 9 |
10 namespace internal { | 10 namespace internal { |
11 | 11 |
12 // Defined in searchbox_extension.cc | 12 // Defined in searchbox_extension.cc |
13 GURL ResolveURL(const GURL& current_url, const string16& possibly_relative_url); | 13 GURL ResolveURL(const GURL& current_url, |
| 14 const base::string16& possibly_relative_url); |
14 | 15 |
15 TEST(SearchboxExtensionTest, ResolveURL) { | 16 TEST(SearchboxExtensionTest, ResolveURL) { |
16 EXPECT_EQ(GURL("http://www.google.com/"), | 17 EXPECT_EQ(GURL("http://www.google.com/"), |
17 ResolveURL(GURL(""), ASCIIToUTF16("http://www.google.com"))); | 18 ResolveURL(GURL(""), ASCIIToUTF16("http://www.google.com"))); |
18 | 19 |
19 EXPECT_EQ(GURL("http://news.google.com/"), | 20 EXPECT_EQ(GURL("http://news.google.com/"), |
20 ResolveURL(GURL("http://www.google.com"), | 21 ResolveURL(GURL("http://www.google.com"), |
21 ASCIIToUTF16("http://news.google.com"))); | 22 ASCIIToUTF16("http://news.google.com"))); |
22 | 23 |
23 EXPECT_EQ(GURL("http://www.google.com/hello?q=world"), | 24 EXPECT_EQ(GURL("http://www.google.com/hello?q=world"), |
24 ResolveURL(GURL("http://www.google.com/foo?a=b"), | 25 ResolveURL(GURL("http://www.google.com/foo?a=b"), |
25 ASCIIToUTF16("hello?q=world"))); | 26 ASCIIToUTF16("hello?q=world"))); |
26 | 27 |
27 EXPECT_EQ(GURL("http://www.google.com:90/foo/hello?q=world"), | 28 EXPECT_EQ(GURL("http://www.google.com:90/foo/hello?q=world"), |
28 ResolveURL(GURL("http://www.google.com:90/"), | 29 ResolveURL(GURL("http://www.google.com:90/"), |
29 ASCIIToUTF16("foo/hello?q=world"))); | 30 ASCIIToUTF16("foo/hello?q=world"))); |
30 } | 31 } |
31 | 32 |
32 } // namespace internal | 33 } // namespace internal |
OLD | NEW |