blob: a67a904e5948c883767037a1d54ee67b3c69675f [file] [log] [blame]
[email protected]b4abd7ff2013-05-02 16:32:341// 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]c0bc38252013-05-08 17:52:175#include "base/basictypes.h"
[email protected]abfd1492013-06-07 21:23:266#include "base/strings/utf_string_conversions.h"
[email protected]b4abd7ff2013-05-02 16:32:347#include "testing/gtest/include/gtest/gtest.h"
[email protected]5f5ef802013-07-04 16:11:138#include "url/gurl.h"
[email protected]b4abd7ff2013-05-02 16:32:349
10namespace internal {
11
12// Defined in searchbox_extension.cc
[email protected]c0bc38252013-05-08 17:52:1713GURL ResolveURL(const GURL& current_url, const string16& possibly_relative_url);
14
15TEST(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]b4abd7ff2013-05-02 16:32:3432} // namespace internal