Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / mojo / shell / query_util_unittest.cc
blob9b28bc50d5769c8184abb9bb35b3b654c5de0a5e
1 // Copyright 2015 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.
5 #include "mojo/shell/query_util.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace mojo {
10 namespace shell {
11 namespace {
13 TEST(QueryUtil, NoQuery) {
14 GURL url("http://www.example.com/");
15 std::string query;
16 GURL base_url = GetBaseURLAndQuery(url, &query);
17 EXPECT_EQ(base_url, url);
18 EXPECT_EQ(query, "");
21 TEST(QueryUtil, WithEmptyQuery) {
22 GURL url("http://www.example.com/?");
23 std::string query;
24 GURL base_url = GetBaseURLAndQuery(url, &query);
25 EXPECT_EQ(base_url, GURL("http://www.example.com/"));
26 EXPECT_EQ(query, "?");
29 TEST(QueryUtil, WithFullQuery) {
30 GURL url("http://www.example.com/?a=b&c=d");
31 std::string query;
32 GURL base_url = GetBaseURLAndQuery(url, &query);
33 EXPECT_EQ(base_url, GURL("http://www.example.com/"));
34 EXPECT_EQ(query, "?a=b&c=d");
37 TEST(QueryUtil, ForFileURL) {
38 GURL url("file:///tmp/file?a=b&c=d");
39 std::string query;
40 GURL base_url = GetBaseURLAndQuery(url, &query);
41 EXPECT_EQ(base_url, GURL("file:///tmp/file"));
42 EXPECT_EQ(query, "?a=b&c=d");
45 } // namespace
46 } // namespace shell
47 } // namespace mojo