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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "chrome/common/instant_types.h" | 6 #include "chrome/common/instant_types.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
9 | 9 |
10 namespace internal { | 10 namespace internal { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 {kValidRenderViewID, GURL("chrome-search://thumb/123/xyz"), 0, false}, | 47 {kValidRenderViewID, GURL("chrome-search://thumb/123/xyz"), 0, false}, |
48 {kValidRenderViewID, GURL("chrome-search://favicon"), 0, false}, | 48 {kValidRenderViewID, GURL("chrome-search://favicon"), 0, false}, |
49 {kValidRenderViewID, GURL("chrome-search://favicon/"), 0, false}, | 49 {kValidRenderViewID, GURL("chrome-search://favicon/"), 0, false}, |
50 {kValidRenderViewID, GURL("chrome-search://favicon/123"), 0, false}, | 50 {kValidRenderViewID, GURL("chrome-search://favicon/123"), 0, false}, |
51 {kValidRenderViewID, GURL("chrome-search://favicon/xyz"), 0, false}, | 51 {kValidRenderViewID, GURL("chrome-search://favicon/xyz"), 0, false}, |
52 {kValidRenderViewID, GURL("chrome-search://favicon/123/"), 0, false}, | 52 {kValidRenderViewID, GURL("chrome-search://favicon/123/"), 0, false}, |
53 {kValidRenderViewID, GURL("chrome-search://favicon/123/xyz"), 0, false} | 53 {kValidRenderViewID, GURL("chrome-search://favicon/123/xyz"), 0, false} |
54 }; | 54 }; |
55 | 55 |
56 InstantRestrictedID rid = 0; | 56 InstantRestrictedID rid = 0; |
57 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 57 for (size_t i = 0; i < arraysize(test_cases); ++i) { |
58 bool return_val = GetRestrictedIDFromThumbnailUrl( | 58 bool return_val = GetRestrictedIDFromThumbnailUrl( |
59 test_cases[i].render_view_id, test_cases[i].transient_url, &rid); | 59 test_cases[i].render_view_id, test_cases[i].transient_url, &rid); |
60 EXPECT_EQ(test_cases[i].expected_return_val, return_val); | 60 EXPECT_EQ(test_cases[i].expected_return_val, return_val); |
61 EXPECT_EQ(test_cases[i].expected_rid, rid); | 61 EXPECT_EQ(test_cases[i].expected_rid, rid); |
62 rid = 0; | 62 rid = 0; |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 TEST(SearchBoxUtilTest, ParseRestrictedFaviconTransientUrl) { | 66 TEST(SearchBoxUtilTest, ParseRestrictedFaviconTransientUrl) { |
67 const int kInvalidRenderViewID = 920; | 67 const int kInvalidRenderViewID = 920; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 kValidRenderViewID, | 209 kValidRenderViewID, |
210 GURL("chrome-search://favicon/invalidparameter/16@2x/1/2"), | 210 GURL("chrome-search://favicon/invalidparameter/16@2x/1/2"), |
211 "", | 211 "", |
212 0, | 212 0, |
213 true | 213 true |
214 } | 214 } |
215 }; | 215 }; |
216 | 216 |
217 std::string favicon_params = ""; | 217 std::string favicon_params = ""; |
218 InstantRestrictedID rid = 0; | 218 InstantRestrictedID rid = 0; |
219 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 219 for (size_t i = 0; i < arraysize(test_cases); ++i) { |
220 bool return_val = GetRestrictedIDFromFaviconUrl( | 220 bool return_val = GetRestrictedIDFromFaviconUrl( |
221 test_cases[i].render_view_id, | 221 test_cases[i].render_view_id, |
222 test_cases[i].transient_url, | 222 test_cases[i].transient_url, |
223 &favicon_params, | 223 &favicon_params, |
224 &rid); | 224 &rid); |
225 EXPECT_EQ(test_cases[i].expected_return_val, return_val); | 225 EXPECT_EQ(test_cases[i].expected_return_val, return_val); |
226 EXPECT_EQ(test_cases[i].expected_favicon_params, favicon_params); | 226 EXPECT_EQ(test_cases[i].expected_favicon_params, favicon_params); |
227 EXPECT_EQ(test_cases[i].expected_rid, rid); | 227 EXPECT_EQ(test_cases[i].expected_rid, rid); |
228 favicon_params = ""; | 228 favicon_params = ""; |
229 rid = 0; | 229 rid = 0; |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 } // namespace internal | 233 } // namespace internal |
OLD | NEW |