OLD | NEW |
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "content/browser/appcache/appcache_group.h" | 10 #include "content/browser/appcache/appcache_group.h" |
(...skipping 2633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2644 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); | 2644 ASSERT_TRUE(base::MessageLoopForIO::IsCurrent()); |
2645 | 2645 |
2646 net::URLRequestJobFactoryImpl* new_factory( | 2646 net::URLRequestJobFactoryImpl* new_factory( |
2647 new net::URLRequestJobFactoryImpl); | 2647 new net::URLRequestJobFactoryImpl); |
2648 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); | 2648 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); |
2649 io_thread_->SetNewJobFactory(new_factory); | 2649 io_thread_->SetNewJobFactory(new_factory); |
2650 | 2650 |
2651 MakeService(); | 2651 MakeService(); |
2652 group_ = new AppCacheGroup( | 2652 group_ = new AppCacheGroup( |
2653 service_->storage(), GURL("http://headertest"), 111); | 2653 service_->storage(), GURL("http://headertest"), 111); |
| 2654 group_->set_last_full_update_check_time(base::Time::Now()); |
2654 AppCacheUpdateJob* update = | 2655 AppCacheUpdateJob* update = |
2655 new AppCacheUpdateJob(service_.get(), group_.get()); | 2656 new AppCacheUpdateJob(service_.get(), group_.get()); |
2656 group_->update_job_ = update; | 2657 group_->update_job_ = update; |
2657 | 2658 |
2658 // First test against a cache attempt. Will start manifest fetch | 2659 // First test against a cache attempt. Will start manifest fetch |
2659 // synchronously. | 2660 // synchronously. |
2660 HttpHeadersRequestTestJob::Initialize(std::string(), std::string()); | 2661 HttpHeadersRequestTestJob::Initialize(std::string(), std::string()); |
2661 MockFrontend mock_frontend; | 2662 MockFrontend mock_frontend; |
2662 AppCacheHost host(1, &mock_frontend, service_.get()); | 2663 AppCacheHost host(1, &mock_frontend, service_.get()); |
2663 update->StartUpdate(&host, GURL()); | 2664 update->StartUpdate(&host, GURL()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 net::URLRequestJobFactoryImpl* new_factory( | 2718 net::URLRequestJobFactoryImpl* new_factory( |
2718 new net::URLRequestJobFactoryImpl); | 2719 new net::URLRequestJobFactoryImpl); |
2719 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); | 2720 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); |
2720 io_thread_->SetNewJobFactory(new_factory); | 2721 io_thread_->SetNewJobFactory(new_factory); |
2721 | 2722 |
2722 MakeService(); | 2723 MakeService(); |
2723 group_ =new AppCacheGroup( | 2724 group_ =new AppCacheGroup( |
2724 service_->storage(), | 2725 service_->storage(), |
2725 MockHttpServer::GetMockUrl("files/manifest1"), | 2726 MockHttpServer::GetMockUrl("files/manifest1"), |
2726 111); | 2727 111); |
| 2728 group_->set_last_full_update_check_time(base::Time::Now()); |
2727 AppCacheUpdateJob* update = | 2729 AppCacheUpdateJob* update = |
2728 new AppCacheUpdateJob(service_.get(), group_.get()); | 2730 new AppCacheUpdateJob(service_.get(), group_.get()); |
2729 group_->update_job_ = update; | 2731 group_->update_job_ = update; |
2730 | 2732 |
2731 // Give the newest cache a manifest enry that is in storage. | 2733 // Give the newest cache a manifest enry that is in storage. |
2732 response_writer_.reset( | 2734 response_writer_.reset( |
2733 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 2735 service_->storage()->CreateResponseWriter(group_->manifest_url(), |
2734 group_->group_id())); | 2736 group_->group_id())); |
2735 | 2737 |
2736 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), | 2738 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 net::URLRequestJobFactoryImpl* new_factory( | 2782 net::URLRequestJobFactoryImpl* new_factory( |
2781 new net::URLRequestJobFactoryImpl); | 2783 new net::URLRequestJobFactoryImpl); |
2782 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); | 2784 new_factory->SetProtocolHandler("http", new IfModifiedSinceJobFactory); |
2783 io_thread_->SetNewJobFactory(new_factory); | 2785 io_thread_->SetNewJobFactory(new_factory); |
2784 | 2786 |
2785 MakeService(); | 2787 MakeService(); |
2786 group_ = new AppCacheGroup( | 2788 group_ = new AppCacheGroup( |
2787 service_->storage(), | 2789 service_->storage(), |
2788 MockHttpServer::GetMockUrl("files/manifest1"), | 2790 MockHttpServer::GetMockUrl("files/manifest1"), |
2789 111); | 2791 111); |
| 2792 group_->set_last_full_update_check_time(base::Time::Now()); |
2790 AppCacheUpdateJob* update = | 2793 AppCacheUpdateJob* update = |
2791 new AppCacheUpdateJob(service_.get(), group_.get()); | 2794 new AppCacheUpdateJob(service_.get(), group_.get()); |
2792 group_->update_job_ = update; | 2795 group_->update_job_ = update; |
2793 | 2796 |
2794 // Give the newest cache a manifest enry that is in storage. | 2797 // Give the newest cache a manifest enry that is in storage. |
2795 response_writer_.reset( | 2798 response_writer_.reset( |
2796 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 2799 service_->storage()->CreateResponseWriter(group_->manifest_url(), |
2797 group_->group_id())); | 2800 group_->group_id())); |
2798 | 2801 |
2799 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), | 2802 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3644 | 3647 |
3645 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { | 3648 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { |
3646 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); | 3649 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); |
3647 } | 3650 } |
3648 | 3651 |
3649 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { | 3652 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { |
3650 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); | 3653 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); |
3651 } | 3654 } |
3652 | 3655 |
3653 } // namespace content | 3656 } // namespace content |
OLD | NEW |