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 "chrome/common/instant_types.h" | 5 #include "chrome/common/instant_types.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 struct TestData { | 10 struct TestData { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 "chrome.2.65.j04" | 42 "chrome.2.65.j04" |
43 }, | 43 }, |
44 // Unescape original query. | 44 // Unescape original query. |
45 {"https://foo/search?q=g+j%20j&oq=g+j&rlz=30&ie=utf-8&aqs=chrome.2.65.j04", | 45 {"https://foo/search?q=g+j%20j&oq=g+j&rlz=30&ie=utf-8&aqs=chrome.2.65.j04", |
46 "g j j", | 46 "g j j", |
47 "g j", | 47 "g j", |
48 "30", | 48 "30", |
49 "utf-8", | 49 "utf-8", |
50 "chrome.2.65.j04" | 50 "chrome.2.65.j04" |
51 }, | 51 }, |
| 52 {"https://foo/search?q=google#q=fun&oq=f&ie=utf-8&aqs=chrome.0.1", |
| 53 "fun", |
| 54 "f", |
| 55 "", |
| 56 "utf-8", |
| 57 "chrome.0.1" |
| 58 }, |
52 }; | 59 }; |
53 | 60 |
54 for (size_t i = 0; i < arraysize(cases); ++i) { | 61 for (size_t i = 0; i < arraysize(cases); ++i) { |
55 EmbeddedSearchRequestParams params(GURL(cases[i].search_request_url)); | 62 EmbeddedSearchRequestParams params(GURL(cases[i].search_request_url)); |
56 EXPECT_EQ(cases[i].expected_search_query, | 63 EXPECT_EQ(cases[i].expected_search_query, |
57 base::UTF16ToASCII(params.search_query)) << "For index: " << i; | 64 base::UTF16ToASCII(params.search_query)) << "For index: " << i; |
58 EXPECT_EQ(cases[i].expected_original_query, | 65 EXPECT_EQ(cases[i].expected_original_query, |
59 base::UTF16ToASCII(params.original_query)) << "For index: " << i; | 66 base::UTF16ToASCII(params.original_query)) << "For index: " << i; |
60 EXPECT_EQ(cases[i].expected_rlz_param, | 67 EXPECT_EQ(cases[i].expected_rlz_param, |
61 base::UTF16ToASCII(params.rlz_parameter_value)) << | 68 base::UTF16ToASCII(params.rlz_parameter_value)) << |
62 "For index: " << i; | 69 "For index: " << i; |
63 EXPECT_EQ(cases[i].expected_input_encoding, | 70 EXPECT_EQ(cases[i].expected_input_encoding, |
64 base::UTF16ToASCII(params.input_encoding)) << "For index: " << i; | 71 base::UTF16ToASCII(params.input_encoding)) << "For index: " << i; |
65 EXPECT_EQ(cases[i].expected_assisted_query_stats, | 72 EXPECT_EQ(cases[i].expected_assisted_query_stats, |
66 base::UTF16ToASCII(params.assisted_query_stats)) << | 73 base::UTF16ToASCII(params.assisted_query_stats)) << |
67 "For index: " << i; | 74 "For index: " << i; |
68 } | 75 } |
69 } | 76 } |
OLD | NEW |