OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "ui/base/webui/web_ui_util.h" | 5 #include "ui/base/webui/web_ui_util.h" |
6 | 6 |
| 7 #include "base/values.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "url/gurl.h" | 9 #include "url/gurl.h" |
9 | 10 |
10 TEST(WebUIUtilTest, ParsePathAndScale) { | 11 TEST(WebUIUtilTest, ParsePathAndScale) { |
11 std::string path; | 12 std::string path; |
12 | 13 |
13 float factor = 0; | 14 float factor = 0; |
14 GURL url("http://some/random/username@email/and/more"); | 15 GURL url("http://some/random/username@email/and/more"); |
15 webui::ParsePathAndScale(url, &path, &factor); | 16 webui::ParsePathAndScale(url, &path, &factor); |
16 EXPECT_EQ("random/username@email/and/more", path); | 17 EXPECT_EQ("random/username@email/and/more", path); |
(...skipping 28 matching lines...) Expand all Loading... |
45 webui::ParsePathAndScale(url6, &path, &factor); | 46 webui::ParsePathAndScale(url6, &path, &factor); |
46 EXPECT_EQ("random/username/and/more", path); | 47 EXPECT_EQ("random/username/and/more", path); |
47 EXPECT_EQ(1.4f, factor); | 48 EXPECT_EQ(1.4f, factor); |
48 | 49 |
49 factor = 0; | 50 factor = 0; |
50 GURL url7("http://some/random/username/and/more@1.3x"); | 51 GURL url7("http://some/random/username/and/more@1.3x"); |
51 webui::ParsePathAndScale(url7, &path, &factor); | 52 webui::ParsePathAndScale(url7, &path, &factor); |
52 EXPECT_EQ("random/username/and/more", path); | 53 EXPECT_EQ("random/username/and/more", path); |
53 EXPECT_EQ(1.3f, factor); | 54 EXPECT_EQ(1.3f, factor); |
54 } | 55 } |
| 56 |
| 57 TEST(WebUIUtilTest, LanguageAndLocale) { |
| 58 base::DictionaryValue defaults; |
| 59 webui::SetLoadTimeDataDefaults("fr-CA", &defaults); |
| 60 |
| 61 std::string language; |
| 62 ASSERT_TRUE(defaults.GetString("language", &language)); |
| 63 EXPECT_STREQ("fr", language.c_str()); |
| 64 |
| 65 std::string locale; |
| 66 ASSERT_TRUE(defaults.GetString("locale", &locale)); |
| 67 EXPECT_STREQ("fr-CA", locale.c_str()); |
| 68 } |
OLD | NEW |