OLD | NEW |
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 Loading... |
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, "ext1", ®ular_request, false, | 151 action_set->CreateDeltas( |
152 ON_BEFORE_REQUEST, WebRequestRule::OptionalRequestData(), | 152 NULL, "ext1", |
153 base::Time()); | 153 WebRequestRule::RequestData(®ular_request, ON_BEFORE_REQUEST), |
| 154 false, base::Time()); |
154 EXPECT_EQ(1u, deltas.size()); | 155 EXPECT_EQ(1u, deltas.size()); |
155 | 156 |
156 TestURLRequest protected_request(GURL(extension_urls::kGalleryBrowsePrefix), | 157 TestURLRequest protected_request(GURL(extension_urls::kGalleryBrowsePrefix), |
157 NULL, &context); | 158 NULL, &context); |
158 deltas = action_set->CreateDeltas(NULL, "ext1", &protected_request, false, | 159 deltas = action_set->CreateDeltas( |
159 ON_BEFORE_REQUEST, WebRequestRule::OptionalRequestData(), | 160 NULL, "ext1", |
160 base::Time()); | 161 WebRequestRule::RequestData(&protected_request, ON_BEFORE_REQUEST), |
| 162 false, base::Time()); |
161 EXPECT_EQ(0u, deltas.size()); | 163 EXPECT_EQ(0u, deltas.size()); |
162 } | 164 } |
163 | 165 |
164 } // namespace extensions | 166 } // namespace extensions |
OLD | NEW |