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

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

Issue 10831008: Refactor and fix declarative webRequest API permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed license headers Created 8 years, 4 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
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_consta nts.h" 9 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h"
10 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" 10 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 actions.push_back(action); 141 actions.push_back(action);
142 142
143 action_set = WebRequestActionSet::Create(actions, &error, &bad_message); 143 action_set = WebRequestActionSet::Create(actions, &error, &bad_message);
144 EXPECT_EQ("", error); 144 EXPECT_EQ("", error);
145 EXPECT_FALSE(bad_message); 145 EXPECT_FALSE(bad_message);
146 ASSERT_TRUE(action.get()); 146 ASSERT_TRUE(action.get());
147 147
148 // Check that redirect works on regular URLs but not on protected URLs. 148 // Check that redirect works on regular URLs but not on protected URLs.
149 TestURLRequest regular_request(GURL("http://test.com"), NULL, &context); 149 TestURLRequest regular_request(GURL("http://test.com"), NULL, &context);
150 std::list<LinkedPtrEventResponseDelta> deltas = 150 std::list<LinkedPtrEventResponseDelta> deltas =
151 action_set->CreateDeltas(NULL, &regular_request, ON_BEFORE_REQUEST, 151 action_set->CreateDeltas(NULL, "ext1", &regular_request, false,
152 WebRequestRule::OptionalRequestData(), "ext1", base::Time()); 152 ON_BEFORE_REQUEST, WebRequestRule::OptionalRequestData(),
153 base::Time());
153 EXPECT_EQ(1u, deltas.size()); 154 EXPECT_EQ(1u, deltas.size());
154 155
155 TestURLRequest protected_request(GURL(extension_urls::kGalleryBrowsePrefix), 156 TestURLRequest protected_request(GURL(extension_urls::kGalleryBrowsePrefix),
156 NULL, &context); 157 NULL, &context);
157 deltas = action_set->CreateDeltas(NULL, &protected_request, ON_BEFORE_REQUEST, 158 deltas = action_set->CreateDeltas(NULL, "ext1", &protected_request, false,
158 WebRequestRule::OptionalRequestData(), "ext1", base::Time()); 159 ON_BEFORE_REQUEST, WebRequestRule::OptionalRequestData(),
160 base::Time());
159 EXPECT_EQ(0u, deltas.size()); 161 EXPECT_EQ(0u, deltas.size());
160 } 162 }
161 163
162 } // namespace extensions 164 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698