1 // Copyright 2013 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 "ui/base/webui/web_ui_util.h"
7 #include "testing/gtest/include/gtest/gtest.h"
10 TEST(WebUIUtilTest
, ParsePathAndScale
) {
14 GURL
url("http://some/random/username@email/and/more");
15 webui::ParsePathAndScale(url
, &path
, &factor
);
16 EXPECT_EQ("random/username@email/and/more", path
);
17 EXPECT_EQ(1.0f
, factor
);
20 GURL
url2("http://some/random/username/and/more");
21 webui::ParsePathAndScale(url2
, &path
, &factor
);
22 EXPECT_EQ("random/username/and/more", path
);
23 EXPECT_EQ(1.0f
, factor
);
26 GURL
url3("http://some/random/username/and/more@2ax");
27 webui::ParsePathAndScale(url3
, &path
, &factor
);
28 EXPECT_EQ("random/username/and/more@2ax", path
);
29 EXPECT_EQ(1.0f
, factor
);
32 GURL
url4("http://some/random/username/and/more@x");
33 webui::ParsePathAndScale(url4
, &path
, &factor
);
34 EXPECT_EQ("random/username/and/more@x", path
);
35 EXPECT_EQ(1.0f
, factor
);
38 GURL
url5("http://some/random/username@email/and/more@2x");
39 webui::ParsePathAndScale(url5
, &path
, &factor
);
40 EXPECT_EQ("random/username@email/and/more", path
);
41 EXPECT_EQ(2.0f
, factor
);
44 GURL
url6("http://some/random/username/and/more@1.4x");
45 webui::ParsePathAndScale(url6
, &path
, &factor
);
46 EXPECT_EQ("random/username/and/more", path
);
47 EXPECT_EQ(1.4f
, factor
);
50 GURL
url7("http://some/random/username/and/more@1.3x");
51 webui::ParsePathAndScale(url7
, &path
, &factor
);
52 EXPECT_EQ("random/username/and/more", path
);
53 EXPECT_EQ(1.3f
, factor
);