ben | f4e3b26 | 2015-09-16 00:10:15 | [diff] [blame] | 1 | // Copyright 2014 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 "mojo/fetcher/url_resolver.h" |
| 6 | |
| 7 | #include "base/files/file_util.h" |
| 8 | #include "base/files/scoped_temp_dir.h" |
| 9 | #include "base/logging.h" |
| 10 | #include "mojo/util/filename_util.h" |
| 11 | #include "testing/gtest/include/gtest/gtest.h" |
| 12 | |
| 13 | namespace mojo { |
| 14 | namespace fetcher { |
| 15 | namespace test { |
| 16 | namespace { |
| 17 | |
| 18 | typedef testing::Test URLResolverTest; |
| 19 | |
| 20 | TEST_F(URLResolverTest, TestQueryForBaseFileURL) { |
| 21 | URLResolver resolver(GURL("file:///base")); |
| 22 | GURL mapped_url = resolver.ResolveMojoURL(GURL("mojo:foo?a=b")); |
| 23 | EXPECT_EQ("file:///base/foo/foo.mojo?a=b", mapped_url.spec()); |
| 24 | } |
| 25 | |
| 26 | TEST_F(URLResolverTest, TestQueryForBaseHttpURL) { |
| 27 | URLResolver resolver(GURL("http://127.0.0.1:1234")); |
| 28 | GURL mapped_url = resolver.ResolveMojoURL(GURL("mojo:foo?a=b")); |
| 29 | EXPECT_EQ("http://127.0.0.1:1234/foo/foo.mojo?a=b", mapped_url.spec()); |
| 30 | } |
| 31 | |
| 32 | } // namespace |
| 33 | } // namespace test |
| 34 | } // namespace fetcher |
| 35 | } // namespace mojo |