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

Unified Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc

Issue 10831150: Refactor request parameters into RequestData struct. Also make RequestStage singular. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: ; 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
index 9a8f4a16ac5fd44a941a8518c61a4cb9fc94d022..54d39e7d3bacb14454c1a87886a274d930ff9bf6 100644
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc
@@ -11,6 +11,7 @@
#include "base/values.h"
#include "chrome/common/extensions/matcher/url_matcher_constants.h"
#include "chrome/browser/extensions/api/declarative_webrequest/webrequest_constants.h"
+#include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rule.h"
#include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
#include "content/public/test/test_browser_thread.h"
#include "net/url_request/url_request_test_util.h"
@@ -215,7 +216,8 @@ TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) {
GURL http_url("http://www.example.com");
TestURLRequestContext context;
TestURLRequest http_request(http_url, NULL, &context);
- matches = registry->GetMatches(&http_request, ON_BEFORE_REQUEST);
+ matches = registry->GetMatches(
+ WebRequestRule::RequestData(&http_request, ON_BEFORE_REQUEST));
EXPECT_EQ(2u, matches.size());
EXPECT_TRUE(matches.find(std::make_pair(kExtensionId, kRuleId1)) !=
matches.end());
@@ -224,7 +226,8 @@ TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) {
GURL foobar_url("http://www.foobar.com");
TestURLRequest foobar_request(foobar_url, NULL, &context);
- matches = registry->GetMatches(&foobar_request, ON_BEFORE_REQUEST);
+ matches = registry->GetMatches(
+ WebRequestRule::RequestData(&foobar_request, ON_BEFORE_REQUEST));
EXPECT_EQ(1u, matches.size());
EXPECT_TRUE(matches.find(std::make_pair(kExtensionId, kRuleId2)) !=
matches.end());
@@ -338,8 +341,10 @@ TEST_F(WebRequestRulesRegistryTest, Precedences) {
TestURLRequestContext context;
TestURLRequest request(url, NULL, &context);
std::list<LinkedPtrEventResponseDelta> deltas =
- registry->CreateDeltas(NULL, &request, false, ON_BEFORE_REQUEST,
- WebRequestRule::OptionalRequestData());
+ registry->CreateDeltas(
+ NULL,
+ WebRequestRule::RequestData(&request, ON_BEFORE_REQUEST, NULL),
battre 2012/08/03 10:06:43 nit: no need to pass NULL here.
Yoyo Zhou 2012/08/03 10:12:19 Oh right, this was before I realized there were en
+ false);
// The second extension is installed later and will win for this reason
// in conflict resolution.
@@ -386,8 +391,10 @@ TEST_F(WebRequestRulesRegistryTest, Priorities) {
TestURLRequestContext context;
TestURLRequest request(url, NULL, &context);
std::list<LinkedPtrEventResponseDelta> deltas =
- registry->CreateDeltas(NULL, &request, false, ON_BEFORE_REQUEST,
- WebRequestRule::OptionalRequestData());
+ registry->CreateDeltas(
+ NULL,
+ WebRequestRule::RequestData(&request, ON_BEFORE_REQUEST, NULL),
battre 2012/08/03 10:06:43 nit: no need to pass NULL here.
+ false);
// The redirect by the first extension is ignored due to the ignore rule.
ASSERT_EQ(1u, deltas.size());

Powered by Google App Engine
This is Rietveld 408576698