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

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

Issue 421393002: Componentize component_updater: Split content::ResourceThrottle from CUS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 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 <vector> 5 #include <vector>
6 6
7 #include "chrome/browser/component_updater/test/component_updater_service_unitte st.h" 7 #include "chrome/browser/component_updater/test/component_updater_service_unitte st.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/component_updater/component_updater_resource_throttle.h "
15 #include "chrome/browser/component_updater/component_updater_utils.h" 16 #include "chrome/browser/component_updater/component_updater_utils.h"
16 #include "chrome/browser/component_updater/test/test_configurator.h" 17 #include "chrome/browser/component_updater/test/test_configurator.h"
17 #include "chrome/browser/component_updater/test/test_installer.h" 18 #include "chrome/browser/component_updater/test/test_installer.h"
18 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/resource_controller.h" 21 #include "content/public/browser/resource_controller.h"
21 #include "content/public/browser/resource_request_info.h" 22 #include "content/public/browser/resource_request_info.h"
22 #include "content/public/browser/resource_throttle.h" 23 #include "content/public/browser/resource_throttle.h"
23 #include "libxml/globals.h" 24 #include "libxml/globals.h"
24 #include "net/base/upload_bytes_element_reader.h" 25 #include "net/base/upload_bytes_element_reader.h"
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 content::ResourceThrottle* RequestTestResourceThrottle( 1184 content::ResourceThrottle* RequestTestResourceThrottle(
1184 ComponentUpdateService* cus, 1185 ComponentUpdateService* cus,
1185 TestResourceController* controller, 1186 TestResourceController* controller,
1186 const char* crx_id) { 1187 const char* crx_id) {
1187 net::TestURLRequestContext context; 1188 net::TestURLRequestContext context;
1188 net::TestURLRequest url_request(GURL("http://foo.example.com/thing.bin"), 1189 net::TestURLRequest url_request(GURL("http://foo.example.com/thing.bin"),
1189 net::DEFAULT_PRIORITY, 1190 net::DEFAULT_PRIORITY,
1190 NULL, 1191 NULL,
1191 &context); 1192 &context);
1192 1193
1193 content::ResourceThrottle* rt = 1194 content::ResourceThrottle* rt = GetOnDemandResourceThrottle(cus, crx_id);
1194 cus->GetOnDemandUpdater().GetOnDemandResourceThrottle(&url_request,
1195 crx_id);
1196 rt->set_controller_for_testing(controller); 1195 rt->set_controller_for_testing(controller);
1197 controller->SetThrottle(rt); 1196 controller->SetThrottle(rt);
1198 return rt; 1197 return rt;
1199 } 1198 }
1200 1199
1201 void RequestAndDeleteResourceThrottle(ComponentUpdateService* cus, 1200 void RequestAndDeleteResourceThrottle(ComponentUpdateService* cus,
1202 const char* crx_id) { 1201 const char* crx_id) {
1203 // By requesting a throttle and deleting it immediately we ensure that we 1202 // By requesting a throttle and deleting it immediately we ensure that we
1204 // hit the case where the component updater tries to use the weak 1203 // hit the case where the component updater tries to use the weak
1205 // pointer to a dead Resource throttle. 1204 // pointer to a dead Resource throttle.
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 component_updater()->RemoveObserver(&observer2); 1489 component_updater()->RemoveObserver(&observer2);
1491 1490
1492 test_configurator()->SetLoopCount(1); 1491 test_configurator()->SetLoopCount(1);
1493 component_updater()->Start(); 1492 component_updater()->Start();
1494 RunThreads(); 1493 RunThreads();
1495 1494
1496 component_updater()->Stop(); 1495 component_updater()->Stop();
1497 } 1496 }
1498 1497
1499 } // namespace component_updater 1498 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698