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

Side by Side Diff: third_party/libaddressinput/chromium/cpp/test/lookup_key_util_test.cc

Issue 110533002: [rac] Temporarily copy libaddressinput to Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid redefinition of basictypes.h Created 7 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (C) 2013 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "lookup_key_util.h"
16
17 #include <gtest/gtest.h>
18
19 namespace {
20
21 using i18n::addressinput::LookupKeyUtil;
22
23 TEST(LookupKeyUtilTest, GetUrlForKey) {
24 const LookupKeyUtil util("test:///");
25 EXPECT_EQ("test:///", util.GetUrlForKey(""));
26 EXPECT_EQ("test:///data", util.GetUrlForKey("data"));
27 EXPECT_EQ("test:///data/US", util.GetUrlForKey("data/US"));
28 EXPECT_EQ("test:///data/CA--fr", util.GetUrlForKey("data/CA--fr"));
29 }
30
31 TEST(LookupKeyUtilTest, GetKeyForUrl) {
32 const LookupKeyUtil util("test:///");
33 EXPECT_EQ("", util.GetKeyForUrl("test://"));
34 EXPECT_EQ("", util.GetKeyForUrl("http://www.google.com/"));
35 EXPECT_EQ("", util.GetKeyForUrl(""));
36 EXPECT_EQ("", util.GetKeyForUrl("test:///"));
37 EXPECT_EQ("data", util.GetKeyForUrl("test:///data"));
38 EXPECT_EQ("data/US", util.GetKeyForUrl("test:///data/US"));
39 EXPECT_EQ("data/CA--fr", util.GetKeyForUrl("test:///data/CA--fr"));
40 }
41
42 TEST(LookupKeyUtilTest, IsValidationDataUrl) {
43 const LookupKeyUtil util("test:///");
44 EXPECT_FALSE(util.IsValidationDataUrl("test://"));
45 EXPECT_FALSE(util.IsValidationDataUrl("http://www.google.com/"));
46 EXPECT_FALSE(util.IsValidationDataUrl(""));
47 EXPECT_TRUE(util.IsValidationDataUrl("test:///"));
48 EXPECT_TRUE(util.IsValidationDataUrl("test:///data"));
49 EXPECT_TRUE(util.IsValidationDataUrl("test:///data/US"));
50 EXPECT_TRUE(util.IsValidationDataUrl("test:///data/CA--fr"));
51 }
52
53 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698