OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "mojo/shell/application_manager/query_util.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace mojo { |
| 10 namespace shell { |
| 11 namespace { |
| 12 |
| 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, ""); |
| 19 } |
| 20 |
| 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, "?"); |
| 27 } |
| 28 |
| 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"); |
| 35 } |
| 36 |
| 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"); |
| 43 } |
| 44 |
| 45 } // namespace |
| 46 } // namespace shell |
| 47 } // namespace mojo |
OLD | NEW |