OLD | NEW |
| (Empty) |
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 "shell/mojo_url_resolver.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "testing/gtest/include/gtest/gtest.h" | |
9 | |
10 namespace mojo { | |
11 namespace shell { | |
12 namespace test { | |
13 namespace { | |
14 | |
15 typedef testing::Test MojoURLResolverTest; | |
16 | |
17 TEST_F(MojoURLResolverTest, MojoURLsFallThrough) { | |
18 MojoURLResolver resolver; | |
19 resolver.AddCustomMapping(GURL("mojo:test"), GURL("mojo:foo")); | |
20 const GURL base_url("file:/base"); | |
21 resolver.SetBaseURL(base_url); | |
22 std::string resolved(resolver.Resolve(GURL("mojo:test")).spec()); | |
23 // Resolved must start with |base_url|. | |
24 EXPECT_EQ(base_url.spec(), resolved.substr(0, base_url.spec().size())); | |
25 // And must contain foo. | |
26 EXPECT_NE(std::string::npos, resolved.find("foo")); | |
27 } | |
28 | |
29 } // namespace | |
30 } // namespace test | |
31 } // namespace shell | |
32 } // namespace mojo | |
OLD | NEW |