Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: ui/base/webui/web_ui_util_unittest.cc

Issue 2032843002: WebUI: add global "locale" key to loadTimeData in many cases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/webui/web_ui_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « ui/base/webui/web_ui_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698