- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / renderer / searchbox / searchbox_extension_unittest.cc
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, 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
32 }  // namespace internal