OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // synchronous placeholder, bad server response etc. | 243 // synchronous placeholder, bad server response etc. |
244 {"synchronous", "", "synchronous", NULL, 0 }, | 244 {"synchronous", "", "synchronous", NULL, 0 }, |
245 {"404", "404", "404", NULL, 0 }, | 245 {"404", "404", "404", NULL, 0 }, |
246 {"500", "500", "500", NULL, 0 }, | 246 {"500", "500", "500", NULL, 0 }, |
247 {"bad json", "invalid json", "bad json", NULL, 0 }, | 247 {"bad json", "invalid json", "bad json", NULL, 0 }, |
248 // Good results. | 248 // Good results. |
249 {"1 result", kOneResult, "app1 name", kParsedOneResult, 1 }, | 249 {"1 result", kOneResult, "app1 name", kParsedOneResult, 1 }, |
250 {"3 result", kThreeResults, "one,two,three", kParsedThreeResults, 3 }, | 250 {"3 result", kThreeResults, "one,two,three", kParsedThreeResults, 3 }, |
251 }; | 251 }; |
252 | 252 |
253 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { | 253 for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
254 if (kTestCases[i].expected_result_titles) { | 254 if (kTestCases[i].expected_result_titles) { |
255 RunQuery(kTestCases[i].query, kTestCases[i].mock_server_response); | 255 RunQuery(kTestCases[i].query, kTestCases[i].mock_server_response); |
256 ASSERT_EQ(kTestCases[i].expected_result_titles, GetResultTitles()) | 256 ASSERT_EQ(kTestCases[i].expected_result_titles, GetResultTitles()) |
257 << "Case " << i << ": q=" << kTestCases[i].query; | 257 << "Case " << i << ": q=" << kTestCases[i].query; |
258 | 258 |
259 if (kTestCases[i].expected_results) { | 259 if (kTestCases[i].expected_results) { |
260 VerifyResults(kTestCases[i].expected_results, | 260 VerifyResults(kTestCases[i].expected_results, |
261 kTestCases[i].expected_result_size); | 261 kTestCases[i].expected_result_size); |
262 } | 262 } |
263 } | 263 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 #endif | 300 #endif |
301 IN_PROC_BROWSER_TEST_F(WebstoreProviderTest, MAYBE_SearchCache) { | 301 IN_PROC_BROWSER_TEST_F(WebstoreProviderTest, MAYBE_SearchCache) { |
302 RunQueryAndVerify("foo", kOneResult, kParsedOneResult, 1); | 302 RunQueryAndVerify("foo", kOneResult, kParsedOneResult, 1); |
303 | 303 |
304 // No result is provided but the provider gets the result from the cache. | 304 // No result is provided but the provider gets the result from the cache. |
305 RunQueryAndVerify("foo", "", kParsedOneResult, 1); | 305 RunQueryAndVerify("foo", "", kParsedOneResult, 1); |
306 } | 306 } |
307 | 307 |
308 } // namespace test | 308 } // namespace test |
309 } // namespace app_list | 309 } // namespace app_list |
OLD | NEW |