OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/web_ui_util.h" |
| 6 |
| 7 #include "googleurl/src/gurl.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 TEST(WebUIUtilTest, ParsePathAndScale) { |
| 11 GURL url("chrome://some/random/username@email/and/more"); |
| 12 std::string path; |
| 13 ui::ScaleFactor factor; |
| 14 |
| 15 web_ui_util::ParsePathAndScale(url, &path, &factor); |
| 16 EXPECT_EQ("random/username@email/and/more", path); |
| 17 EXPECT_EQ(ui::SCALE_FACTOR_NONE, factor); |
| 18 |
| 19 GURL url2("chrome://some/random/username@email/and/more@2x"); |
| 20 web_ui_util::ParsePathAndScale(url2, &path, &factor); |
| 21 EXPECT_EQ("random/username@email/and/more", path); |
| 22 EXPECT_EQ(ui::SCALE_FACTOR_200P, factor); |
| 23 |
| 24 GURL url3("chrome://some/random/username/and/more@2x"); |
| 25 web_ui_util::ParsePathAndScale(url3, &path, &factor); |
| 26 EXPECT_EQ("random/username/and/more", path); |
| 27 EXPECT_EQ(ui::SCALE_FACTOR_200P, factor); |
| 28 |
| 29 GURL url4("chrome://some/random/username/and/more"); |
| 30 web_ui_util::ParsePathAndScale(url4, &path, &factor); |
| 31 EXPECT_EQ("random/username/and/more", path); |
| 32 EXPECT_EQ(ui::SCALE_FACTOR_NONE, factor); |
| 33 } |
OLD | NEW |