Index: chrome/common/chrome_plugin_unittest.cc |
=================================================================== |
--- chrome/common/chrome_plugin_unittest.cc (revision 8565) |
+++ chrome/common/chrome_plugin_unittest.cc (working copy) |
@@ -11,6 +11,7 @@ |
#include "chrome/browser/profile.h" |
#include "chrome/common/chrome_plugin_lib.h" |
#include "chrome/test/chrome_plugin/test_chrome_plugin.h" |
+#include "net/base/io_buffer.h" |
#include "net/url_request/url_request_test_job.h" |
#include "net/url_request/url_request_unittest.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -19,11 +20,13 @@ |
const wchar_t kDocRoot[] = L"chrome/test/data"; |
const char kPluginFilename[] = "test_chrome_plugin.dll"; |
+const int kResponseBufferSize = 4096; |
class ChromePluginTest : public testing::Test, public URLRequest::Delegate { |
public: |
ChromePluginTest() |
: request_(NULL), |
+ response_buffer_(new net::IOBuffer(kResponseBufferSize)), |
plugin_(NULL), |
expected_payload_(NULL), |
request_context_(new TestURLRequestContext()) { |
@@ -75,7 +78,7 @@ |
// Note: we use URLRequest (instead of URLFetcher) because this allows the |
// request to be intercepted. |
scoped_ptr<URLRequest> request_; |
- char response_buffer_[4096]; |
+ scoped_refptr<net::IOBuffer> response_buffer_; |
std::string response_data_; |
ChromePluginLib* plugin_; |
@@ -155,7 +158,7 @@ |
int bytes_read = 0; |
if (request_->status().is_success()) |
- request_->Read(response_buffer_, sizeof(response_buffer_), &bytes_read); |
+ request_->Read(response_buffer_, kResponseBufferSize, &bytes_read); |
OnReadCompleted(request_.get(), bytes_read); |
} |
@@ -165,9 +168,8 @@ |
do { |
if (!request_->status().is_success() || bytes_read <= 0) |
break; |
- response_data_.append(response_buffer_, bytes_read); |
- } while (request_->Read(response_buffer_, sizeof(response_buffer_), |
- &bytes_read)); |
+ response_data_.append(response_buffer_->data(), bytes_read); |
+ } while (request_->Read(response_buffer_, kResponseBufferSize, &bytes_read)); |
if (!request_->status().is_io_pending()) { |
OnURLRequestComplete(); |