| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/rlz/rlz.h" | 8 #include "chrome/browser/rlz/rlz.h" |
| 9 #include "chrome/browser/search_engines/template_url.h" | 9 #include "chrome/browser/search_engines/template_url.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } to_wide_cases[] = { | 137 } to_wide_cases[] = { |
| 138 {"hello+world", L"hello world"}, | 138 {"hello+world", L"hello world"}, |
| 139 // Test some big-5 input. | 139 // Test some big-5 input. |
| 140 {"%a7A%A6%6e+to+you", L"\x4f60\x597d to you"}, | 140 {"%a7A%A6%6e+to+you", L"\x4f60\x597d to you"}, |
| 141 // Test some UTF-8 input. We should fall back to this when the encoding | 141 // Test some UTF-8 input. We should fall back to this when the encoding |
| 142 // doesn't look like big-5. We have a '5' in the middle, which is an invalid | 142 // doesn't look like big-5. We have a '5' in the middle, which is an invalid |
| 143 // Big-5 trailing byte. | 143 // Big-5 trailing byte. |
| 144 {"%e4%bd%a05%e5%a5%bd+to+you", L"\x4f60\x35\x597d to you"}, | 144 {"%e4%bd%a05%e5%a5%bd+to+you", L"\x4f60\x35\x597d to you"}, |
| 145 // Undecodable input should stay escaped. | 145 // Undecodable input should stay escaped. |
| 146 {"%91%01+abcd", L"%91%01 abcd"}, | 146 {"%91%01+abcd", L"%91%01 abcd"}, |
| 147 // Make sure we convert %2B to +. |
| 148 {"C%2B%2B", L"C++"}, |
| 149 // C%2B is escaped as C%252B, make sure we unescape it properly. |
| 150 {"C%252B", L"C%2B"}, |
| 147 }; | 151 }; |
| 148 | 152 |
| 149 TemplateURL t_url; | 153 TemplateURL t_url; |
| 150 | 154 |
| 151 // Set one input encoding: big-5. This is so we can test fallback to UTF-8. | 155 // Set one input encoding: big-5. This is so we can test fallback to UTF-8. |
| 152 std::vector<std::string> encodings; | 156 std::vector<std::string> encodings; |
| 153 encodings.push_back("big-5"); | 157 encodings.push_back("big-5"); |
| 154 t_url.set_input_encodings(encodings); | 158 t_url.set_input_encodings(encodings); |
| 155 | 159 |
| 156 TemplateURLRef ref(L"http://foo?q={searchTerms}", 1, 2); | 160 TemplateURLRef ref(L"http://foo?q={searchTerms}", 1, 2); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 EXPECT_FALSE(t_url.autogenerate_keyword()); | 390 EXPECT_FALSE(t_url.autogenerate_keyword()); |
| 387 t_url.set_keyword(L"foo"); | 391 t_url.set_keyword(L"foo"); |
| 388 EXPECT_EQ(L"foo", t_url.keyword()); | 392 EXPECT_EQ(L"foo", t_url.keyword()); |
| 389 t_url.set_autogenerate_keyword(true); | 393 t_url.set_autogenerate_keyword(true); |
| 390 EXPECT_TRUE(t_url.autogenerate_keyword()); | 394 EXPECT_TRUE(t_url.autogenerate_keyword()); |
| 391 EXPECT_EQ(L"google.com", t_url.keyword()); | 395 EXPECT_EQ(L"google.com", t_url.keyword()); |
| 392 t_url.set_keyword(L"foo"); | 396 t_url.set_keyword(L"foo"); |
| 393 EXPECT_FALSE(t_url.autogenerate_keyword()); | 397 EXPECT_FALSE(t_url.autogenerate_keyword()); |
| 394 EXPECT_EQ(L"foo", t_url.keyword()); | 398 EXPECT_EQ(L"foo", t_url.keyword()); |
| 395 } | 399 } |
| OLD | NEW |