| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/web_ui_util.h" | 5 #include "chrome/browser/ui/webui/web_ui_util.h" |
| 6 | 6 |
| 7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 TEST(WebUIUtilTest, ParsePathAndScale) { | 10 TEST(WebUIUtilTest, ParsePathAndScale) { |
| 11 GURL url("chrome://some/random/username@email/and/more"); | 11 GURL url("chrome://some/random/username@email/and/more"); |
| 12 std::string path; | 12 std::string path; |
| 13 ui::ScaleFactor factor; | 13 ui::ScaleFactor factor; |
| 14 | 14 |
| 15 web_ui_util::ParsePathAndScale(url, &path, &factor); | 15 web_ui_util::ParsePathAndScale(url, &path, &factor); |
| 16 EXPECT_EQ("random/username@email/and/more", path); | 16 EXPECT_EQ("random/username@email/and/more", path); |
| 17 EXPECT_EQ(ui::SCALE_FACTOR_NONE, factor); | 17 EXPECT_EQ(ui::SCALE_FACTOR_100P, factor); |
| 18 | 18 |
| 19 GURL url2("chrome://some/random/username@email/and/more@2x"); | 19 GURL url2("chrome://some/random/username@email/and/more@2x"); |
| 20 web_ui_util::ParsePathAndScale(url2, &path, &factor); | 20 web_ui_util::ParsePathAndScale(url2, &path, &factor); |
| 21 EXPECT_EQ("random/username@email/and/more", path); | 21 EXPECT_EQ("random/username@email/and/more", path); |
| 22 EXPECT_EQ(ui::SCALE_FACTOR_200P, factor); | 22 EXPECT_EQ(ui::SCALE_FACTOR_200P, factor); |
| 23 | 23 |
| 24 GURL url3("chrome://some/random/username/and/more@2x"); | 24 GURL url3("chrome://some/random/username/and/more@2x"); |
| 25 web_ui_util::ParsePathAndScale(url3, &path, &factor); | 25 web_ui_util::ParsePathAndScale(url3, &path, &factor); |
| 26 EXPECT_EQ("random/username/and/more", path); | 26 EXPECT_EQ("random/username/and/more", path); |
| 27 EXPECT_EQ(ui::SCALE_FACTOR_200P, factor); | 27 EXPECT_EQ(ui::SCALE_FACTOR_200P, factor); |
| 28 | 28 |
| 29 GURL url4("chrome://some/random/username/and/more"); | 29 GURL url4("chrome://some/random/username/and/more"); |
| 30 web_ui_util::ParsePathAndScale(url4, &path, &factor); | 30 web_ui_util::ParsePathAndScale(url4, &path, &factor); |
| 31 EXPECT_EQ("random/username/and/more", path); | 31 EXPECT_EQ("random/username/and/more", path); |
| 32 EXPECT_EQ(ui::SCALE_FACTOR_NONE, factor); | 32 EXPECT_EQ(ui::SCALE_FACTOR_100P, factor); |
| 33 } | 33 } |
| OLD | NEW |