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