From 33ad6ce948e24e01ec1634af63001dda4ac0506a Mon Sep 17 00:00:00 2001 From: "earthdok@chromium.org" Date: Tue, 27 Aug 2013 14:39:08 +0000 Subject: Revert 219709 "Remove the Extensions URLRequestContext." Reverted due to crashes under memory tools. BUG=280138 > Remove the Extensions URLRequestContext. > > Though chrome-extension: scheme URLs support cookies, they do not share > a namespace with http: and https:. In particular, chrome-extension://a and > http://a should not have the same set of cookies. > > To enforce this, previously the code created a completely separate > URLRequestContext for servicing chrome-extension: schemes. However, > the code really only used this object as a method for conveying the > correct cookie jar from Profile creation to a few spots where cookies > were accessed; the rest of the URLRequestContext functionality was unused. > > This CL removes the Extensions URLRequestContext code and replaces it > with APIs that directly expose the needed net::CookieStore. > > Lastly, CookieMonster::EnableFileScheme() is removed and > CookieMonster::Delegate is renamed CookieMonsterDelegate. > > EnableFileScheme is an inherently racy API because > CookieMonsters are creatable on all threads and this > function sets an unprotected global flag. CookieMonsterDelegate > is preferable to the nested interface because it can now be > forward declared. > > TBRing darin and sky to cover the rest of the mechanical unittest changes. > > TBR=darin,sky > BUG=158386,159193,57884 > > Review URL: https://chromiumcodereview.appspot.com/12546016 TBR=ajwong@chromium.org Review URL: https://codereview.chromium.org/23551005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219787 0039d316-1c4b-4281-b951-d872f2087c98 --- .../printing/print_dialog_cloud_unittest.cc | 37 ++++++++++++++++------ 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'chrome/browser/printing') diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc index 4b4e9a8..c08ffa8 100644 --- a/chrome/browser/printing/print_dialog_cloud_unittest.cc +++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc @@ -22,11 +22,10 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" -#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" -#include "content/public/test/test_browser_thread_bundle.h" +#include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -149,20 +148,26 @@ class MockCloudPrintDataSenderHelper : public CloudPrintDataSenderHelper { }; class CloudPrintURLTest : public testing::Test { + public: + CloudPrintURLTest() {} + protected: - content::TestBrowserThreadBundle thread_bundle_; - TestingProfile profile_; + virtual void SetUp() { + profile_.reset(new TestingProfile()); + } + + scoped_ptr profile_; }; TEST_F(CloudPrintURLTest, CheckDefaultURLs) { std::string service_url = - CloudPrintURL(&profile_). + CloudPrintURL(profile_.get()). GetCloudPrintServiceURL().spec(); EXPECT_THAT(service_url, HasSubstr("www.google.com")); EXPECT_THAT(service_url, HasSubstr("cloudprint")); std::string dialog_url = - CloudPrintURL(&profile_). + CloudPrintURL(profile_.get()). GetCloudPrintServiceDialogURL().spec(); EXPECT_THAT(dialog_url, HasSubstr("www.google.com")); EXPECT_THAT(dialog_url, HasSubstr("/cloudprint/")); @@ -172,7 +177,7 @@ TEST_F(CloudPrintURLTest, CheckDefaultURLs) { // Repeat to make sure there isn't a transient glitch. dialog_url = - CloudPrintURL(&profile_). + CloudPrintURL(profile_.get()). GetCloudPrintServiceDialogURL().spec(); EXPECT_THAT(dialog_url, HasSubstr("www.google.com")); EXPECT_THAT(dialog_url, HasSubstr("/cloudprint/")); @@ -181,7 +186,7 @@ TEST_F(CloudPrintURLTest, CheckDefaultURLs) { EXPECT_THAT(dialog_url, HasSubstr("/dialog.html")); std::string manage_url = - CloudPrintURL(&profile_). + CloudPrintURL(profile_.get()). GetCloudPrintServiceManageURL().spec(); EXPECT_THAT(manage_url, HasSubstr("www.google.com")); EXPECT_THAT(manage_url, HasSubstr("/cloudprint/")); @@ -208,6 +213,11 @@ TEST_F(CloudPrintURLTest, CheckDefaultURLs) { // Testing for CloudPrintDataSender needs a mock WebUI. class CloudPrintDataSenderTest : public testing::Test { + public: + CloudPrintDataSenderTest() + : file_thread_(BrowserThread::FILE, &message_loop_), + io_thread_(BrowserThread::IO, &message_loop_) {} + protected: virtual void SetUp() { mock_helper_.reset(new MockCloudPrintDataSenderHelper); @@ -225,7 +235,9 @@ class CloudPrintDataSenderTest : public testing::Test { scoped_refptr print_data_sender_; scoped_ptr mock_helper_; - content::TestBrowserThreadBundle thread_bundle_; + base::MessageLoop message_loop_; + content::TestBrowserThread file_thread_; + content::TestBrowserThread io_thread_; }; TEST_F(CloudPrintDataSenderTest, CanSend) { @@ -279,6 +291,10 @@ using internal_cloud_print_helpers::MockCloudPrintFlowHandler; using internal_cloud_print_helpers::CloudPrintWebDialogDelegate; class CloudPrintWebDialogDelegateTest : public testing::Test { + public: + CloudPrintWebDialogDelegateTest() + : ui_thread_(BrowserThread::UI, &message_loop_) {} + protected: virtual void SetUp() { string16 mock_title; @@ -300,7 +316,8 @@ class CloudPrintWebDialogDelegateTest : public testing::Test { delete mock_flow_handler_.get(); } - content::TestBrowserThreadBundle thread_bundle_; + base::MessageLoopForUI message_loop_; + content::TestBrowserThread ui_thread_; base::WeakPtr mock_flow_handler_; scoped_ptr delegate_; }; -- cgit v1.1