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 "shell/application_manager/query_util.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace mojo { |
| 10 namespace { |
| 11 |
| 12 TEST(QueryUtil, NoQuery) { |
| 13 GURL url("http://www.example.com/"); |
| 14 std::string query; |
| 15 GURL base_url = GetBaseURLAndQuery(url, &query); |
| 16 EXPECT_EQ(base_url, url); |
| 17 EXPECT_EQ(query, ""); |
| 18 } |
| 19 |
| 20 TEST(QueryUtil, WithEmptyQuery) { |
| 21 GURL url("http://www.example.com/?"); |
| 22 std::string query; |
| 23 GURL base_url = GetBaseURLAndQuery(url, &query); |
| 24 EXPECT_EQ(base_url, GURL("http://www.example.com/")); |
| 25 EXPECT_EQ(query, "?"); |
| 26 } |
| 27 |
| 28 TEST(QueryUtil, WithFullQuery) { |
| 29 GURL url("http://www.example.com/?a=b&c=d"); |
| 30 std::string query; |
| 31 GURL base_url = GetBaseURLAndQuery(url, &query); |
| 32 EXPECT_EQ(base_url, GURL("http://www.example.com/")); |
| 33 EXPECT_EQ(query, "?a=b&c=d"); |
| 34 } |
| 35 |
| 36 TEST(QueryUtil, ForFileURL) { |
| 37 GURL url("file:///tmp/file?a=b&c=d"); |
| 38 std::string query; |
| 39 GURL base_url = GetBaseURLAndQuery(url, &query); |
| 40 EXPECT_EQ(base_url, GURL("file:///tmp/file")); |
| 41 EXPECT_EQ(query, "?a=b&c=d"); |
| 42 } |
| 43 |
| 44 } // namespace shell |
| 45 } // namespace |
OLD | NEW |