Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: chrome/renderer/searchbox/searchbox_unittest.cc

Issue 15907006: Rip out browser-side RID caching for most visited items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/searchbox/searchbox_extension.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/basictypes.h"
6 #include "chrome/common/instant_types.h"
7 #include "googleurl/src/gurl.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace internal {
11
12 // Defined in searchbox_extension.cc
13 bool GetInstantRestrictedIDFromURL(int render_view_id,
14 const GURL& url,
15 InstantRestrictedID* id);
16
17 TEST(SearchBoxUtilTest, GetInstantRestrictedIDFromTransientURL) {
18 const int kInvalidRenderViewID = 920;
19 const int kValidRenderViewID = 1;
20
21 const struct {
22 int render_view_id;
23 GURL transient_url;
24 InstantRestrictedID expected_rid;
25 bool expected_return_val;
26 } test_cases[] = {
27 // RenderView ID matches the view id specified in the transient url.
28 {kValidRenderViewID, GURL("chrome-search://favicon/1/2"), 2, true},
29 {kValidRenderViewID, GURL("chrome-search://thumb/1/2"), 2, true},
30
31 // RenderView ID does not match the view id specified in the transient url.
32 {kInvalidRenderViewID, GURL("chrome-search://favicon/1/2"), 0, false},
33 {kInvalidRenderViewID, GURL("chrome-search://thumb/1/2"), 0, false},
34
35 // Invalid transient urls.
36 {kValidRenderViewID, GURL("chrome-search://thumb"), 0, false},
37 {kValidRenderViewID, GURL("chrome-search://thumb/"), 0, false},
38 {kValidRenderViewID, GURL("chrome-search://thumb/123"), 0, false},
39 {kValidRenderViewID, GURL("chrome-search://thumb/xyz"), 0, false},
40 {kValidRenderViewID, GURL("chrome-search://thumb/123/"), 0, false},
41 {kValidRenderViewID, GURL("chrome-search://thumb/123/xyz"), 0, false},
42 {kValidRenderViewID, GURL("chrome-search://favicon"), 0, false},
43 {kValidRenderViewID, GURL("chrome-search://favicon/"), 0, false},
44 {kValidRenderViewID, GURL("chrome-search://favicon/123"), 0, false},
45 {kValidRenderViewID, GURL("chrome-search://favicon/xyz"), 0, false},
46 {kValidRenderViewID, GURL("chrome-search://favicon/123/"), 0, false},
47 {kValidRenderViewID, GURL("chrome-search://favicon/123/xyz"), 0, false}
48 };
49
50 InstantRestrictedID rid = 0;
51 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) {
52 bool return_val = GetInstantRestrictedIDFromURL(
53 test_cases[i].render_view_id, test_cases[i].transient_url, &rid);
54 EXPECT_EQ(test_cases[i].expected_return_val, return_val);
55 EXPECT_EQ(test_cases[i].expected_rid, rid);
56 rid = 0;
57 }
58 }
59
60 } // namespace internal
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox_extension.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698