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

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

Issue 51953002: [Net] Add a priority parameter to URLRequest's constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 1 month 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/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/test/values_test_util.h" 13 #include "base/test/values_test_util.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" 16 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h"
17 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h" 17 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h"
18 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h" 18 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h"
19 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" 19 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
20 #include "chrome/browser/extensions/extension_info_map.h" 20 #include "chrome/browser/extensions/extension_info_map.h"
21 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/extensions/extension_constants.h" 23 #include "chrome/common/extensions/extension_constants.h"
24 #include "chrome/common/extensions/extension_test_util.h" 24 #include "chrome/common/extensions/extension_test_util.h"
25 #include "content/public/test/test_browser_thread_bundle.h" 25 #include "content/public/test/test_browser_thread_bundle.h"
26 #include "net/base/request_priority.h"
26 #include "net/http/http_response_headers.h" 27 #include "net/http/http_response_headers.h"
27 #include "net/url_request/url_request_test_util.h" 28 #include "net/url_request/url_request_test_util.h"
28 #include "testing/gmock/include/gmock/gmock.h" 29 #include "testing/gmock/include/gmock/gmock.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 31
31 using base::DictionaryValue; 32 using base::DictionaryValue;
32 using base::ListValue; 33 using base::ListValue;
33 using extension_test_util::LoadManifestUnchecked; 34 using extension_test_util::LoadManifestUnchecked;
34 using testing::HasSubstr; 35 using testing::HasSubstr;
35 36
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 extension_info_map_->AddExtension(extension_all_urls_.get(), 129 extension_info_map_->AddExtension(extension_all_urls_.get(),
129 base::Time::Now(), 130 base::Time::Now(),
130 false /*incognito_enabled*/); 131 false /*incognito_enabled*/);
131 } 132 }
132 133
133 bool WebRequestActionWithThreadsTest::ActionWorksOnRequest( 134 bool WebRequestActionWithThreadsTest::ActionWorksOnRequest(
134 const char* url_string, 135 const char* url_string,
135 const std::string& extension_id, 136 const std::string& extension_id,
136 const WebRequestActionSet* action_set, 137 const WebRequestActionSet* action_set,
137 RequestStage stage) { 138 RequestStage stage) {
138 net::TestURLRequest regular_request(GURL(url_string), NULL, &context_, NULL); 139 net::TestURLRequest regular_request(
140 GURL(url_string), net::DEFAULT_PRIORITY, NULL, &context_);
139 std::list<LinkedPtrEventResponseDelta> deltas; 141 std::list<LinkedPtrEventResponseDelta> deltas;
140 scoped_refptr<net::HttpResponseHeaders> headers( 142 scoped_refptr<net::HttpResponseHeaders> headers(
141 new net::HttpResponseHeaders("")); 143 new net::HttpResponseHeaders(""));
142 WebRequestData request_data(&regular_request, stage, headers.get()); 144 WebRequestData request_data(&regular_request, stage, headers.get());
143 std::set<std::string> ignored_tags; 145 std::set<std::string> ignored_tags;
144 WebRequestAction::ApplyInfo apply_info = { extension_info_map_.get(), 146 WebRequestAction::ApplyInfo apply_info = { extension_info_map_.get(),
145 request_data, 147 request_data,
146 false /*crosses_incognito*/, 148 false /*crosses_incognito*/,
147 &deltas, &ignored_tags }; 149 &deltas, &ignored_tags };
148 action_set->Apply(extension_id, base::Time(), &apply_info); 150 action_set->Apply(extension_id, base::Time(), &apply_info);
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 for (WebRequestActionSet::Actions::const_iterator it = 568 for (WebRequestActionSet::Actions::const_iterator it =
567 action_set->actions().begin(); 569 action_set->actions().begin();
568 it != action_set->actions().end(); 570 it != action_set->actions().end();
569 ++it) { 571 ++it) {
570 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); 572 EXPECT_EQ(kExpectedNames[index], (*it)->GetName());
571 ++index; 573 ++index;
572 } 574 }
573 } 575 }
574 576
575 } // namespace extensions 577 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698