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

Side by Side Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc

Issue 12328079: Update TestURLRequest constructor interface in extensions unit tests. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebase onto master. Created 7 years, 9 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 | « no previous file | chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/extensions/api/declarative_webrequest/webrequest_action .h" 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_action .h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h" 9 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h"
10 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h" 10 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 redirect.SetString(keys::kRedirectUrlKey, "http://www.foobar.com"); 130 redirect.SetString(keys::kRedirectUrlKey, "http://www.foobar.com");
131 131
132 WebRequestActionSet::AnyVector actions; 132 WebRequestActionSet::AnyVector actions;
133 actions.push_back(linked_ptr<base::Value>(redirect.DeepCopy())); 133 actions.push_back(linked_ptr<base::Value>(redirect.DeepCopy()));
134 134
135 action_set = WebRequestActionSet::Create(actions, &error, &bad_message); 135 action_set = WebRequestActionSet::Create(actions, &error, &bad_message);
136 EXPECT_EQ("", error); 136 EXPECT_EQ("", error);
137 EXPECT_FALSE(bad_message); 137 EXPECT_FALSE(bad_message);
138 138
139 // Check that redirect works on regular URLs but not on protected URLs. 139 // Check that redirect works on regular URLs but not on protected URLs.
140 net::TestURLRequest regular_request(GURL("http://test.com"), NULL, &context); 140 net::TestURLRequest regular_request(
141 GURL("http://test.com"), NULL, &context, NULL);
141 std::list<LinkedPtrEventResponseDelta> deltas; 142 std::list<LinkedPtrEventResponseDelta> deltas;
142 WebRequestData request_data(&regular_request, ON_BEFORE_REQUEST); 143 WebRequestData request_data(&regular_request, ON_BEFORE_REQUEST);
143 WebRequestAction::ApplyInfo apply_info = { 144 WebRequestAction::ApplyInfo apply_info = {
144 NULL, request_data, false, &deltas 145 NULL, request_data, false, &deltas
145 }; 146 };
146 action_set->Apply("ext1", base::Time(), &apply_info); 147 action_set->Apply("ext1", base::Time(), &apply_info);
147 EXPECT_EQ(1u, deltas.size()); 148 EXPECT_EQ(1u, deltas.size());
148 149
149 net::TestURLRequest protected_request(GURL("http://clients1.google.com"), 150 net::TestURLRequest protected_request(GURL("http://clients1.google.com"),
150 NULL, &context); 151 NULL, &context, NULL);
151 deltas.clear(); 152 deltas.clear();
152 request_data = WebRequestData(&protected_request, ON_BEFORE_REQUEST); 153 request_data = WebRequestData(&protected_request, ON_BEFORE_REQUEST);
153 // Note that we just updated the request_data reference in apply_info. 154 // Note that we just updated the request_data reference in apply_info.
154 action_set->Apply("ext1", base::Time(), &apply_info); 155 action_set->Apply("ext1", base::Time(), &apply_info);
155 EXPECT_EQ(0u, deltas.size()); 156 EXPECT_EQ(0u, deltas.size());
156 } 157 }
157 158
158 } // namespace extensions 159 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698