OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
14 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
15 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 17 #include "net/base/request_priority.h" |
16 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
17 #include "net/url_request/url_request_error_job.h" | 19 #include "net/url_request/url_request_error_job.h" |
18 #include "net/url_request/url_request_job_factory_impl.h" | 20 #include "net/url_request/url_request_job_factory_impl.h" |
19 #include "net/url_request/url_request_test_job.h" | 21 #include "net/url_request/url_request_test_job.h" |
20 #include "net/url_request/url_request_test_util.h" | 22 #include "net/url_request/url_request_test_util.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "webkit/browser/appcache/appcache.h" | 24 #include "webkit/browser/appcache/appcache.h" |
23 #include "webkit/browser/appcache/appcache_backend_impl.h" | 25 #include "webkit/browser/appcache/appcache_backend_impl.h" |
24 #include "webkit/browser/appcache/appcache_database.h" | 26 #include "webkit/browser/appcache/appcache_database.h" |
25 #include "webkit/browser/appcache/appcache_entry.h" | 27 #include "webkit/browser/appcache/appcache_entry.h" |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 kNoCacheId, | 1699 kNoCacheId, |
1698 MockHttpServer::GetMockUrl("manifest")); | 1700 MockHttpServer::GetMockUrl("manifest")); |
1699 } else { | 1701 } else { |
1700 ASSERT_EQ(2, test_case); | 1702 ASSERT_EQ(2, test_case); |
1701 // Try to access the existing cache manifest. | 1703 // Try to access the existing cache manifest. |
1702 // The URLRequestJob will eventually fail when it gets to disk | 1704 // The URLRequestJob will eventually fail when it gets to disk |
1703 // cache initialization. | 1705 // cache initialization. |
1704 backend_->RegisterHost(2); | 1706 backend_->RegisterHost(2); |
1705 AppCacheHost* host2 = backend_->GetHost(2); | 1707 AppCacheHost* host2 = backend_->GetHost(2); |
1706 GURL manifest_url = MockHttpServer::GetMockUrl("manifest"); | 1708 GURL manifest_url = MockHttpServer::GetMockUrl("manifest"); |
1707 request_.reset( | 1709 request_ = service()->request_context()->CreateRequest( |
1708 service()->request_context()->CreateRequest(manifest_url, NULL)); | 1710 manifest_url, net::DEFAULT_PRIORITY, NULL); |
1709 AppCacheInterceptor::SetExtraRequestInfo( | 1711 AppCacheInterceptor::SetExtraRequestInfo( |
1710 request_.get(), service_.get(), | 1712 request_.get(), service_.get(), |
1711 backend_->process_id(), host2->host_id(), | 1713 backend_->process_id(), host2->host_id(), |
1712 ResourceType::MAIN_FRAME); | 1714 ResourceType::MAIN_FRAME); |
1713 request_->Start(); | 1715 request_->Start(); |
1714 } | 1716 } |
1715 | 1717 |
1716 PushNextTask(base::Bind( | 1718 PushNextTask(base::Bind( |
1717 &AppCacheStorageImplTest::Verify_Reinitialized, | 1719 &AppCacheStorageImplTest::Verify_Reinitialized, |
1718 base::Unretained(this), | 1720 base::Unretained(this), |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize1); | 1950 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize1); |
1949 } | 1951 } |
1950 | 1952 |
1951 TEST_F(AppCacheStorageImplTest, Reinitialize2) { | 1953 TEST_F(AppCacheStorageImplTest, Reinitialize2) { |
1952 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); | 1954 RunTestOnIOThread(&AppCacheStorageImplTest::Reinitialize2); |
1953 } | 1955 } |
1954 | 1956 |
1955 // That's all folks! | 1957 // That's all folks! |
1956 | 1958 |
1957 } // namespace appcache | 1959 } // namespace appcache |
OLD | NEW |