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