Fix typo in AshWindowTreeHostOzone
[chromium-blink-merge.git] / ui / base / webui / web_ui_util_unittest.cc
blob59ed4a5d21d25a5831977a7f1cf306a002eedf21
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"
8 #include "url/gurl.h"
10 TEST(WebUIUtilTest, ParsePathAndScale) {
11 std::vector<ui::ScaleFactor> supported_scale_factors;
12 supported_scale_factors.push_back(ui::SCALE_FACTOR_100P);
13 supported_scale_factors.push_back(ui::SCALE_FACTOR_140P);
14 supported_scale_factors.push_back(ui::SCALE_FACTOR_200P);
15 ui::test::ScopedSetSupportedScaleFactors scoped_supported(
16 supported_scale_factors);
18 std::string path;
19 ui::ScaleFactor factor;
21 GURL url("http://some/random/username@email/and/more");
22 webui::ParsePathAndScale(url, &path, &factor);
23 EXPECT_EQ("random/username@email/and/more", path);
24 EXPECT_EQ(ui::SCALE_FACTOR_100P, factor);
26 GURL url2("http://some/random/username/and/more");
27 webui::ParsePathAndScale(url2, &path, &factor);
28 EXPECT_EQ("random/username/and/more", path);
29 EXPECT_EQ(ui::SCALE_FACTOR_100P, factor);
31 GURL url3("http://some/random/username/and/more@2ax");
32 webui::ParsePathAndScale(url3, &path, &factor);
33 EXPECT_EQ("random/username/and/more@2ax", path);
34 EXPECT_EQ(ui::SCALE_FACTOR_100P, factor);
36 GURL url4("http://some/random/username/and/more@x");
37 webui::ParsePathAndScale(url4, &path, &factor);
38 EXPECT_EQ("random/username/and/more@x", path);
39 EXPECT_EQ(ui::SCALE_FACTOR_100P, factor);
41 GURL url5("http://some/random/username@email/and/more@2x");
42 webui::ParsePathAndScale(url5, &path, &factor);
43 EXPECT_EQ("random/username@email/and/more", path);
44 EXPECT_EQ(ui::SCALE_FACTOR_200P, factor);
46 GURL url6("http://some/random/username/and/more@1.4x");
47 webui::ParsePathAndScale(url6, &path, &factor);
48 EXPECT_EQ("random/username/and/more", path);
49 EXPECT_EQ(ui::SCALE_FACTOR_140P, factor);
51 GURL url7("http://some/random/username/and/more@1.3x");
52 webui::ParsePathAndScale(url7, &path, &factor);
53 EXPECT_EQ("random/username/and/more", path);
54 EXPECT_EQ(ui::SCALE_FACTOR_140P, factor);