From 37ac95b451ae3cdddf327b9bfc3ba350b149b5ff Mon Sep 17 00:00:00 2001 From: "ajwong@chromium.org" Date: Tue, 23 Jul 2013 23:39:35 +0000 Subject: Correctly integrate StoragePartition into TestingProfile. Until this CL, TestingProfile had 3 distinct URLRequestContexts it would return to the user: one via profile->GetDefaultStoragePartition()->GetRequestContext(), one via profile->GetRequestContext(), and one via profile->GetResourceContext->GetRequestContext(). All of these had different cookie stores. This CL unified them so they all return the one from profile->GetDefaultStoragePartition()->GetRequestContext(). This correctly mimics how production code works. Doing this had a bunch of implications: (1) Removes TestingProfile::CreateRequestContext()/ResetRequestContext() (2) Changes MockRequestContext to share the URLRequestContext with TestingProfile. (3) TestingProfile now requires all BrowserThreads. Point (3) effectively adds TestBrowserThreadBundle into a bunch more spots. Because of that, we also have the following changes: (a) AshTestBase now has a TestBrowserThreadBundle (b) Removed a bunch of real threads from tests. (c) TemplateUrlService has reworked synchronization semantics. (d) Removed MultiThreadTestHelper. (e) Added TestingIOThread class + testing API in IOThread to mock out various IO thread tasks which enervated with the new TestBrowserThreadBundle. TBR=bauerb,brettw,isherman,joth,jyasskin,mattm,mmenke,mnissler,pkasting,rkc,rlp,satorux,tim,xians,joth BUG=159193 Review URL: https://chromiumcodereview.appspot.com/17127002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213272 0039d316-1c4b-4281-b951-d872f2087c98 --- .../intercept_navigation_resource_throttle_unittest.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'components/navigation_interception') diff --git a/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc index dfccb30..e1bd566 100644 --- a/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc +++ b/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc @@ -26,13 +26,14 @@ #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" #include "net/url_request/url_request.h" +#include "net/url_request/url_request_test_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" using testing::_; using testing::Eq; -using testing::Property; using testing::Ne; +using testing::Property; using testing::Return; namespace navigation_interception { @@ -117,7 +118,8 @@ class TestIOThreadState { const std::string& request_method, RedirectMode redirect_mode, MockInterceptCallbackReceiver* callback_receiver) - : request_(url, NULL, resource_context_.GetRequestContext()) { + : resource_context_(&test_url_request_context_), + request_(url, NULL, resource_context_.GetRequestContext()) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); if (render_process_id != MSG_ROUTING_NONE && render_view_id != MSG_ROUTING_NONE) { @@ -164,6 +166,7 @@ class TestIOThreadState { } private: + net::TestURLRequestContext test_url_request_context_; content::MockResourceContext resource_context_; net::URLRequest request_; scoped_ptr throttle_; -- cgit v1.1