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

Side by Side Diff: chrome/browser/component_updater/test/component_updater_service_unittest.cc

Issue 501163002: Make URLRequest's constructor private, and make URLRequestContext a friend class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge yet again Created 6 years, 3 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/component_updater/test/component_updater_service_unitte st.h" 5 #include "chrome/browser/component_updater/test/component_updater_service_unitte st.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 11 #include "base/path_service.h"
11 #include "base/run_loop.h" 12 #include "base/run_loop.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "chrome/browser/component_updater/component_updater_resource_throttle.h " 17 #include "chrome/browser/component_updater/component_updater_resource_throttle.h "
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "components/component_updater/component_updater_utils.h" 19 #include "components/component_updater/component_updater_utils.h"
19 #include "components/component_updater/test/test_configurator.h" 20 #include "components/component_updater/test/test_configurator.h"
20 #include "components/component_updater/test/test_installer.h" 21 #include "components/component_updater/test/test_installer.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/resource_controller.h" 23 #include "content/public/browser/resource_controller.h"
23 #include "content/public/browser/resource_request_info.h" 24 #include "content/public/browser/resource_request_info.h"
24 #include "content/public/browser/resource_throttle.h" 25 #include "content/public/browser/resource_throttle.h"
25 #include "libxml/globals.h" 26 #include "libxml/globals.h"
26 #include "net/base/upload_bytes_element_reader.h" 27 #include "net/base/upload_bytes_element_reader.h"
27 #include "net/url_request/url_fetcher.h" 28 #include "net/url_request/url_fetcher.h"
29 #include "net/url_request/url_request.h"
28 #include "net/url_request/url_request_test_util.h" 30 #include "net/url_request/url_request_test_util.h"
29 #include "url/gurl.h" 31 #include "url/gurl.h"
30 32
31 using content::BrowserThread; 33 using content::BrowserThread;
32 34
33 using ::testing::_; 35 using ::testing::_;
34 using ::testing::AnyNumber; 36 using ::testing::AnyNumber;
35 using ::testing::InSequence; 37 using ::testing::InSequence;
36 using ::testing::Mock; 38 using ::testing::Mock;
37 39
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 class TestResourceController : public content::ResourceController { 1177 class TestResourceController : public content::ResourceController {
1176 public: 1178 public:
1177 virtual void SetThrottle(content::ResourceThrottle* throttle) {} 1179 virtual void SetThrottle(content::ResourceThrottle* throttle) {}
1178 }; 1180 };
1179 1181
1180 content::ResourceThrottle* RequestTestResourceThrottle( 1182 content::ResourceThrottle* RequestTestResourceThrottle(
1181 ComponentUpdateService* cus, 1183 ComponentUpdateService* cus,
1182 TestResourceController* controller, 1184 TestResourceController* controller,
1183 const char* crx_id) { 1185 const char* crx_id) {
1184 net::TestURLRequestContext context; 1186 net::TestURLRequestContext context;
1185 net::TestURLRequest url_request(GURL("http://foo.example.com/thing.bin"), 1187 scoped_ptr<net::URLRequest> url_request(context.CreateRequest(
1186 net::DEFAULT_PRIORITY, 1188 GURL("http://foo.example.com/thing.bin"),
1187 NULL, 1189 net::DEFAULT_PRIORITY,
1188 &context); 1190 NULL,
1191 NULL));
1189 1192
1190 content::ResourceThrottle* rt = GetOnDemandResourceThrottle(cus, crx_id); 1193 content::ResourceThrottle* rt = GetOnDemandResourceThrottle(cus, crx_id);
1191 rt->set_controller_for_testing(controller); 1194 rt->set_controller_for_testing(controller);
1192 controller->SetThrottle(rt); 1195 controller->SetThrottle(rt);
1193 return rt; 1196 return rt;
1194 } 1197 }
1195 1198
1196 void RequestAndDeleteResourceThrottle(ComponentUpdateService* cus, 1199 void RequestAndDeleteResourceThrottle(ComponentUpdateService* cus,
1197 const char* crx_id) { 1200 const char* crx_id) {
1198 // By requesting a throttle and deleting it immediately we ensure that we 1201 // By requesting a throttle and deleting it immediately we ensure that we
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 component_updater()->RemoveObserver(&observer2); 1488 component_updater()->RemoveObserver(&observer2);
1486 1489
1487 test_configurator()->SetLoopCount(1); 1490 test_configurator()->SetLoopCount(1);
1488 component_updater()->Start(); 1491 component_updater()->Start();
1489 RunThreads(); 1492 RunThreads();
1490 1493
1491 component_updater()->Stop(); 1494 component_updater()->Stop();
1492 } 1495 }
1493 1496
1494 } // namespace component_updater 1497 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698