OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "third_party/libaddressinput/chromium/cpp/src/rule.h" | 5 #include "third_party/libaddressinput/src/cpp/src/rule.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 TEST(RuleTest, CanonicalizeSubKeyTest) { | 12 TEST(RuleTest, CanonicalizeSubKeyTest) { |
13 i18n::addressinput::Rule rule; | 13 i18n::addressinput::Rule rule; |
14 ASSERT_TRUE(rule.ParseSerializedRule(base::WideToUTF8( | 14 ASSERT_TRUE(rule.ParseSerializedRule(base::WideToUTF8( |
15 L"{ \"sub_keys\": \"FOO~BAR~B\u00C4Z~\u0415\u0416\"," | 15 L"{ \"sub_keys\": \"FOO~BAR~B\u00C4Z~\u0415\u0416\"," |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 for (size_t i = 0; i < num_cases; ++i) { | 49 for (size_t i = 0; i < num_cases; ++i) { |
50 const std::string input(base::WideToUTF8(expectations[i].input)); | 50 const std::string input(base::WideToUTF8(expectations[i].input)); |
51 const std::string expected_output(base::WideToUTF8(expectations[i].output)); | 51 const std::string expected_output(base::WideToUTF8(expectations[i].output)); |
52 std::string output; | 52 std::string output; |
53 EXPECT_EQ(!expected_output.empty(), | 53 EXPECT_EQ(!expected_output.empty(), |
54 rule.CanonicalizeSubKey(input, true, &output)) | 54 rule.CanonicalizeSubKey(input, true, &output)) |
55 << "Failed for input " << input; | 55 << "Failed for input " << input; |
56 EXPECT_EQ(expected_output, output); | 56 EXPECT_EQ(expected_output, output); |
57 } | 57 } |
58 } | 58 } |
OLD | NEW |