OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "mojo/runner/url_resolver.h" | 5 #include "mojo/runner/url_resolver.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "mojo/util/filename_util.h" | 10 #include "mojo/util/filename_util.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 namespace shell { | 14 namespace runner { |
15 namespace test { | 15 namespace test { |
16 namespace { | 16 namespace { |
17 | 17 |
18 typedef testing::Test URLResolverTest; | 18 typedef testing::Test URLResolverTest; |
19 | 19 |
20 TEST_F(URLResolverTest, MojoURLsFallThrough) { | 20 TEST_F(URLResolverTest, MojoURLsFallThrough) { |
21 URLResolver resolver; | 21 URLResolver resolver; |
22 resolver.AddURLMapping(GURL("mojo:test"), GURL("mojo:foo")); | 22 resolver.AddURLMapping(GURL("mojo:test"), GURL("mojo:foo")); |
23 const GURL base_url("file:/base"); | 23 const GURL base_url("file:/base"); |
24 resolver.SetMojoBaseURL(base_url); | 24 resolver.SetMojoBaseURL(base_url); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 const base::FilePath foo_file_path( | 163 const base::FilePath foo_file_path( |
164 tmp_dir.path().Append(FILE_PATH_LITERAL("foo"))); | 164 tmp_dir.path().Append(FILE_PATH_LITERAL("foo"))); |
165 ASSERT_TRUE(base::CreateDirectory(foo_file_path)); | 165 ASSERT_TRUE(base::CreateDirectory(foo_file_path)); |
166 const GURL mapped_url_with_dir = resolver.ResolveMojoURL(GURL("mojo:foo")); | 166 const GURL mapped_url_with_dir = resolver.ResolveMojoURL(GURL("mojo:foo")); |
167 EXPECT_EQ(util::FilePathToFileURL(tmp_dir.path()).spec() + "/foo/foo.mojo", | 167 EXPECT_EQ(util::FilePathToFileURL(tmp_dir.path()).spec() + "/foo/foo.mojo", |
168 mapped_url_with_dir.spec()); | 168 mapped_url_with_dir.spec()); |
169 } | 169 } |
170 | 170 |
171 } // namespace | 171 } // namespace |
172 } // namespace test | 172 } // namespace test |
173 } // namespace shell | 173 } // namespace runner |
174 } // namespace mojo | 174 } // namespace mojo |
OLD | NEW |