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"
13 TEST(QueryUtil
, NoQuery
) {
14 GURL
url("http://www.example.com/");
16 GURL base_url
= GetBaseURLAndQuery(url
, &query
);
17 EXPECT_EQ(base_url
, url
);
21 TEST(QueryUtil
, WithEmptyQuery
) {
22 GURL
url("http://www.example.com/?");
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");
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");
40 GURL base_url
= GetBaseURLAndQuery(url
, &query
);
41 EXPECT_EQ(base_url
, GURL("file:///tmp/file"));
42 EXPECT_EQ(query
, "?a=b&c=d");