diff options
author | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-05 18:26:16 +0000 |
---|---|---|
committer | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-05 18:26:16 +0000 |
commit | d0fef94d21559d72a47dc44a23d2adf147e79264 (patch) | |
tree | 9a03b9bece791905cb49b3d29e7854272f41cc1c /content/renderer/pepper/pepper_url_request_unittest.cc | |
parent | 7e797793d31525002837e3a078be62a7c9e94c4e (diff) | |
download | chromium_src-d0fef94d21559d72a47dc44a23d2adf147e79264.zip chromium_src-d0fef94d21559d72a47dc44a23d2adf147e79264.tar.gz chromium_src-d0fef94d21559d72a47dc44a23d2adf147e79264.tar.bz2 |
Revert 215401 "Pepper: Make CreateWebURLRequest async."
> Pepper: Make CreateWebURLRequest async.
>
> This is part of a series of changes that will eventually make
> URLRequestInfo::AppendToBody asynchronous. This is needed as part of the
> refactor of FileRef to the browser from the renderer.
>
> BUG=225441
>
> Review URL: https://chromiumcodereview.appspot.com/21507003
TBR=teravest@chromium.org
Review URL: https://codereview.chromium.org/22242002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/pepper/pepper_url_request_unittest.cc')
-rw-r--r-- | content/renderer/pepper/pepper_url_request_unittest.cc | 99 |
1 files changed, 21 insertions, 78 deletions
diff --git a/content/renderer/pepper/pepper_url_request_unittest.cc b/content/renderer/pepper/pepper_url_request_unittest.cc index fc13200..20e7f92 100644 --- a/content/renderer/pepper/pepper_url_request_unittest.cc +++ b/content/renderer/pepper/pepper_url_request_unittest.cc @@ -55,8 +55,7 @@ namespace content { class URLRequestInfoTest : public RenderViewTest { public: - URLRequestInfoTest() : pp_instance_(1234), - get_download_to_file_result_(false) { + URLRequestInfoTest() : pp_instance_(1234) { } virtual void SetUp() OVERRIDE { @@ -76,85 +75,35 @@ class URLRequestInfoTest : public RenderViewTest { } bool GetDownloadToFile() { - get_download_to_file_result_ = false; - - scoped_ptr<URLRequestInfoData> data( - new URLRequestInfoData(info_->GetData())); - CreateWebURLRequest(data.Pass(), GetMainFrame(), - base::Bind(&URLRequestInfoTest::GetDownloadToFileCallback, - base::Unretained(this))); - base::MessageLoop::current()->RunUntilIdle(); - - return get_download_to_file_result_; - } - - void GetDownloadToFileCallback(scoped_ptr<URLRequestInfoData> data, - bool success, - scoped_ptr<WebURLRequest> web_request) { - EXPECT_TRUE(success); - get_download_to_file_result_ = web_request->downloadToFile(); + WebURLRequest web_request; + URLRequestInfoData data = info_->GetData(); + if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) + return false; + return web_request.downloadToFile(); } WebCString GetURL() { - get_url_result_ = WebCString(); - - scoped_ptr<URLRequestInfoData> data( - new URLRequestInfoData(info_->GetData())); - CreateWebURLRequest(data.Pass(), GetMainFrame(), - base::Bind(&URLRequestInfoTest::GetURLCallback, - base::Unretained(this))); - base::MessageLoop::current()->RunUntilIdle(); - - return get_url_result_; - } - - void GetURLCallback(scoped_ptr<URLRequestInfoData> data, - bool success, - scoped_ptr<WebURLRequest> web_request) { - EXPECT_TRUE(success); - get_url_result_ = web_request->url().spec(); + WebURLRequest web_request; + URLRequestInfoData data = info_->GetData(); + if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) + return WebCString(); + return web_request.url().spec(); } WebString GetMethod() { - get_method_result_ = WebString(); - - scoped_ptr<URLRequestInfoData> data( - new URLRequestInfoData(info_->GetData())); - CreateWebURLRequest(data.Pass(), GetMainFrame(), - base::Bind(&URLRequestInfoTest::GetMethodCallback, - base::Unretained(this))); - base::MessageLoop::current()->RunUntilIdle(); - - return get_method_result_; - } - - void GetMethodCallback(scoped_ptr<URLRequestInfoData> data, - bool success, - scoped_ptr<WebURLRequest> web_request) { - EXPECT_TRUE(success); - get_method_result_ = web_request->httpMethod(); + WebURLRequest web_request; + URLRequestInfoData data = info_->GetData(); + if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) + return WebString(); + return web_request.httpMethod(); } WebString GetHeaderValue(const char* field) { - get_header_value_result_ = WebString(); - - scoped_ptr<URLRequestInfoData> data( - new URLRequestInfoData(info_->GetData())); - CreateWebURLRequest(data.Pass(), GetMainFrame(), - base::Bind(&URLRequestInfoTest::GetHeaderValueCallback, - base::Unretained(this), field)); - base::MessageLoop::current()->RunUntilIdle(); - - return get_header_value_result_; - } - - void GetHeaderValueCallback(const char* field, - scoped_ptr<URLRequestInfoData> data, - bool success, - scoped_ptr<WebURLRequest> web_request) { - EXPECT_TRUE(success); - get_header_value_result_ = web_request->httpHeaderField( - WebString::fromUTF8(field)); + WebURLRequest web_request; + URLRequestInfoData data = info_->GetData(); + if (!CreateWebURLRequest(&data, GetMainFrame(), &web_request)) + return WebString(); + return web_request.httpHeaderField(WebString::fromUTF8(field)); } bool SetBooleanProperty(PP_URLRequestProperty prop, bool b) { @@ -170,12 +119,6 @@ class URLRequestInfoTest : public RenderViewTest { ::ppapi::TestGlobals test_globals_; scoped_refptr<URLRequestInfoResource> info_; - - // Result fields for getting responses from asynchronous operations. - bool get_download_to_file_result_; - WebCString get_url_result_; - WebString get_method_result_; - WebString get_header_value_result_; }; TEST_F(URLRequestInfoTest, GetInterface) { |