Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: content/browser/appcache/appcache_storage_impl_unittest.cc

Issue 1523433002: Remove support for a URLRequest having a NULL Delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix iOS Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stack> 5 #include <stack>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 ASSERT_TRUE(db_thread->StartWithOptions(options)); 384 ASSERT_TRUE(db_thread->StartWithOptions(options));
385 } 385 }
386 386
387 static void TearDownTestCase() { 387 static void TearDownTestCase() {
388 io_thread.reset(NULL); 388 io_thread.reset(NULL);
389 db_thread.reset(NULL); 389 db_thread.reset(NULL);
390 } 390 }
391 391
392 // Test harness -------------------------------------------------- 392 // Test harness --------------------------------------------------
393 393
394 AppCacheStorageImplTest() { 394 AppCacheStorageImplTest() { request_delegate_.set_quit_on_complete(false); }
mmenke 2015/12/14 17:02:30 Note that I used a different approach here and req
395 }
396 395
397 template <class Method> 396 template <class Method>
398 void RunTestOnIOThread(Method method) { 397 void RunTestOnIOThread(Method method) {
399 test_finished_event_ .reset(new base::WaitableEvent(false, false)); 398 test_finished_event_ .reset(new base::WaitableEvent(false, false));
400 io_thread->task_runner()->PostTask( 399 io_thread->task_runner()->PostTask(
401 FROM_HERE, base::Bind(&AppCacheStorageImplTest::MethodWrapper<Method>, 400 FROM_HERE, base::Bind(&AppCacheStorageImplTest::MethodWrapper<Method>,
402 base::Unretained(this), method)); 401 base::Unretained(this), method));
403 test_finished_event_->Wait(); 402 test_finished_event_->Wait();
404 } 403 }
405 404
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 MockHttpServer::GetMockUrl("manifest")); 1757 MockHttpServer::GetMockUrl("manifest"));
1759 } else { 1758 } else {
1760 ASSERT_EQ(CORRUPT_CACHE_ON_LOAD_EXISTING, test_case); 1759 ASSERT_EQ(CORRUPT_CACHE_ON_LOAD_EXISTING, test_case);
1761 // Try to access the existing cache manifest. 1760 // Try to access the existing cache manifest.
1762 // The URLRequestJob will eventually fail when it gets to disk 1761 // The URLRequestJob will eventually fail when it gets to disk
1763 // cache initialization. 1762 // cache initialization.
1764 backend_->RegisterHost(2); 1763 backend_->RegisterHost(2);
1765 AppCacheHost* host2 = backend_->GetHost(2); 1764 AppCacheHost* host2 = backend_->GetHost(2);
1766 GURL manifest_url = MockHttpServer::GetMockUrl("manifest"); 1765 GURL manifest_url = MockHttpServer::GetMockUrl("manifest");
1767 request_ = service()->request_context()->CreateRequest( 1766 request_ = service()->request_context()->CreateRequest(
1768 manifest_url, net::DEFAULT_PRIORITY, NULL); 1767 manifest_url, net::DEFAULT_PRIORITY, &request_delegate_);
1769 AppCacheInterceptor::SetExtraRequestInfo( 1768 AppCacheInterceptor::SetExtraRequestInfo(
1770 request_.get(), service_.get(), 1769 request_.get(), service_.get(),
1771 backend_->process_id(), host2->host_id(), 1770 backend_->process_id(), host2->host_id(),
1772 RESOURCE_TYPE_MAIN_FRAME, 1771 RESOURCE_TYPE_MAIN_FRAME,
1773 false); 1772 false);
1774 request_->Start(); 1773 request_->Start();
1775 } 1774 }
1776 1775
1777 PushNextTask(base::Bind( 1776 PushNextTask(base::Bind(
1778 &AppCacheStorageImplTest::Verify_Reinitialized, 1777 &AppCacheStorageImplTest::Verify_Reinitialized,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 scoped_refptr<MockQuotaManagerProxy> mock_quota_manager_proxy_; 1883 scoped_refptr<MockQuotaManagerProxy> mock_quota_manager_proxy_;
1885 scoped_refptr<AppCacheGroup> group_; 1884 scoped_refptr<AppCacheGroup> group_;
1886 scoped_refptr<AppCache> cache_; 1885 scoped_refptr<AppCache> cache_;
1887 scoped_refptr<AppCache> cache2_; 1886 scoped_refptr<AppCache> cache2_;
1888 1887
1889 // Specifically for the Reinitalize test. 1888 // Specifically for the Reinitalize test.
1890 base::ScopedTempDir temp_directory_; 1889 base::ScopedTempDir temp_directory_;
1891 scoped_ptr<MockServiceObserver> observer_; 1890 scoped_ptr<MockServiceObserver> observer_;
1892 MockAppCacheFrontend frontend_; 1891 MockAppCacheFrontend frontend_;
1893 scoped_ptr<AppCacheBackendImpl> backend_; 1892 scoped_ptr<AppCacheBackendImpl> backend_;
1893 net::TestDelegate request_delegate_;
1894 scoped_ptr<net::URLRequest> request_; 1894 scoped_ptr<net::URLRequest> request_;
1895 }; 1895 };
1896 1896
1897 1897
1898 TEST_F(AppCacheStorageImplTest, LoadCache_Miss) { 1898 TEST_F(AppCacheStorageImplTest, LoadCache_Miss) {
1899 RunTestOnIOThread(&AppCacheStorageImplTest::LoadCache_Miss); 1899 RunTestOnIOThread(&AppCacheStorageImplTest::LoadCache_Miss);
1900 } 1900 }
1901 1901
1902 TEST_F(AppCacheStorageImplTest, LoadCache_NearHit) { 1902 TEST_F(AppCacheStorageImplTest, LoadCache_NearHit) {
1903 RunTestOnIOThread(&AppCacheStorageImplTest::LoadCache_NearHit); 1903 RunTestOnIOThread(&AppCacheStorageImplTest::LoadCache_NearHit);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); 2021 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2);
2022 } 2022 }
2023 2023
2024 TEST_F(AppCacheStorageImplTest, Reinitialize3) { 2024 TEST_F(AppCacheStorageImplTest, Reinitialize3) {
2025 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3); 2025 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize3);
2026 } 2026 }
2027 2027
2028 // That's all folks! 2028 // That's all folks!
2029 2029
2030 } // namespace content 2030 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ios/web/net/request_tracker_impl_unittest.mm » ('j') | net/url_request/url_request.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698