Commit 6f346127 authored by tedv@chromium.org's avatar tedv@chromium.org

Make use of network delegate explicit in drive unit tests using TestURLRequest.

The older interface assumes an implicit relationship between a URLRequestContext
and its delegate.  This interface has been deprecated in favor of making the
network delegate explicit.

BUG=146587


Review URL: https://chromiumcodereview.appspot.com/13079008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192977 0039d316-1c4b-4281-b951-d872f2087c98
parent fd18b738
......@@ -34,6 +34,16 @@ class DriveURLRequestJobTest : public testing::Test {
url_request_context_.reset(new net::TestURLRequestContext);
delegate_.reset(new net::TestDelegate);
network_delegate_.reset(new net::TestNetworkDelegate);
// TODO(tedv): Using the NetworkDelegate with the URLRequestContext
// with set_network_delegate() instead of a NULL delegate causes
// unit test failures, which should be fixed. This occurs because
// the TestNetworkDelegate generates a failure if an failed request
// is generated before the OnBeforeURLRequest() method is called,
// and DriveURLRequestJob::Start() does not call OnBeforeURLRequest().
// There is further discussion of this at:
// https://codereview.chromium.org/13079008/
//url_request_context_.set_network_delegate(network_delegate_.get());
}
MessageLoopForIO message_loop_;
......@@ -47,7 +57,7 @@ class DriveURLRequestJobTest : public testing::Test {
TEST_F(DriveURLRequestJobTest, NonGetMethod) {
net::TestURLRequest request(
util::FilePathToDriveURL(base::FilePath::FromUTF8Unsafe("file")),
delegate_.get(), url_request_context_.get());
delegate_.get(), url_request_context_.get(), NULL);
request.set_method("POST"); // Set non "GET" method.
scoped_refptr<DriveURLRequestJob> job(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment