Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: mojo/shell/mojo_url_resolver_unittest.cc

Issue 658503003: Enables specifying mojo url mapping on command line (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweaks Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/shell/mojo_url_resolver_unittest.cc
diff --git a/mojo/shell/mojo_url_resolver_unittest.cc b/mojo/shell/mojo_url_resolver_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e4deffa31eedcaf75a865178c2395cf0a08d4ed3
--- /dev/null
+++ b/mojo/shell/mojo_url_resolver_unittest.cc
@@ -0,0 +1,32 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/shell/mojo_url_resolver.h"
+
+#include "base/logging.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace shell {
+namespace test {
+namespace {
+
+typedef testing::Test MojoURLResolverTest;
+
+TEST_F(MojoURLResolverTest, MojoURLsFallThrough) {
+ MojoURLResolver resolver;
+ resolver.AddCustomMapping(GURL("mojo:test"), GURL("mojo:foo"));
+ const GURL base_url("file:/base");
+ resolver.SetBaseURL(base_url);
+ const std::string resolved(resolver.Resolve(GURL("mojo:test")).spec());
+ // Resolved must start with |base_url|.
+ EXPECT_EQ(base_url.spec(), resolved.substr(0, base_url.spec().size()));
+ // And must contain foo (which is what test mapped to.
+ EXPECT_NE(std::string::npos, resolved.find("foo"));
+}
+
+} // namespace
+} // namespace test
+} // namespace shell
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698