#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/pickle.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_job_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
using net::IOBuffer;
using net::WrappedIOBuffer;
return false;
}
- private:
- mutable net::URLRequestJob* job_;
+ private:
+ mutable net::URLRequestJob* job_;
};
class AppCacheURLRequestJobTest : public testing::Test {
// Basic -------------------------------------------------------------------
void Basic() {
AppCacheStorage* storage = service_->storage();
- net::URLRequest request(GURL("http://blah/"), net::DEFAULT_PRIORITY, NULL,
- empty_context_.get());
+ scoped_ptr<net::URLRequest> request(empty_context_->CreateRequest(
+ GURL("http://blah/"), net::DEFAULT_PRIORITY, NULL, NULL));
scoped_refptr<AppCacheURLRequestJob> job;
// Create an instance and see that it looks as expected.
- job = new AppCacheURLRequestJob(
- &request, NULL, storage, NULL, false);
+ job = new AppCacheURLRequestJob(request.get(), NULL, storage, NULL, false);
EXPECT_TRUE(job->is_waiting());
EXPECT_FALSE(job->is_delivering_appcache_response());
EXPECT_FALSE(job->is_delivering_network_response());
// DeliveryOrders -----------------------------------------------------
void DeliveryOrders() {
AppCacheStorage* storage = service_->storage();
- net::URLRequest request(GURL("http://blah/"), net::DEFAULT_PRIORITY, NULL,
- empty_context_.get());
+ scoped_ptr<net::URLRequest> request(empty_context_->CreateRequest(
+ GURL("http://blah/"), net::DEFAULT_PRIORITY, NULL, NULL));
scoped_refptr<AppCacheURLRequestJob> job;
// Create an instance, give it a delivery order and see that
// it looks as expected.
- job = new AppCacheURLRequestJob(&request, NULL, storage, NULL, false);
+ job = new AppCacheURLRequestJob(request.get(), NULL, storage, NULL, false);
job->DeliverErrorResponse();
EXPECT_TRUE(job->is_delivering_error_response());
EXPECT_FALSE(job->has_been_started());
- job = new AppCacheURLRequestJob(&request, NULL, storage, NULL, false);
+ job = new AppCacheURLRequestJob(request.get(), NULL, storage, NULL, false);
job->DeliverNetworkResponse();
EXPECT_TRUE(job->is_delivering_network_response());
EXPECT_FALSE(job->has_been_started());
- job = new AppCacheURLRequestJob(&request, NULL, storage, NULL, false);
+ job = new AppCacheURLRequestJob(request.get(), NULL, storage, NULL, false);
const GURL kManifestUrl("http://blah/");
const int64 kCacheId(1);
const int64 kGroupId(1);