| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/thread.h" | 8 #include "base/thread.h" |
| 9 #include "base/waitable_event.h" | 9 #include "base/waitable_event.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 for (std::vector<AppCacheHost*>::iterator it = update_hosts_.begin(); | 43 for (std::vector<AppCacheHost*>::iterator it = update_hosts_.begin(); |
| 44 it != update_hosts_.end(); ++it) { | 44 it != update_hosts_.end(); ++it) { |
| 45 AppCacheHost* host = *it; | 45 AppCacheHost* host = *it; |
| 46 update_->StartUpdate(host, | 46 update_->StartUpdate(host, |
| 47 (host ? host->pending_master_entry_url() : GURL())); | 47 (host ? host->pending_master_entry_url() : GURL())); |
| 48 } | 48 } |
| 49 update_hosts_.clear(); // only trigger once | 49 update_hosts_.clear(); // only trigger once |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 virtual void OnContentBlocked(int host_id) { |
| 54 } |
| 55 |
| 53 void AddExpectedEvent(const std::vector<int>& host_ids, EventID event_id) { | 56 void AddExpectedEvent(const std::vector<int>& host_ids, EventID event_id) { |
| 54 expected_events_.push_back(RaisedEvent(host_ids, event_id)); | 57 expected_events_.push_back(RaisedEvent(host_ids, event_id)); |
| 55 } | 58 } |
| 56 | 59 |
| 57 void TriggerAdditionalUpdates(EventID trigger_event, | 60 void TriggerAdditionalUpdates(EventID trigger_event, |
| 58 AppCacheUpdateJob* update) { | 61 AppCacheUpdateJob* update) { |
| 59 start_update_trigger_ = trigger_event; | 62 start_update_trigger_ = trigger_event; |
| 60 update_ = update; | 63 update_ = update; |
| 61 } | 64 } |
| 62 | 65 |
| (...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2552 else | 2555 else |
| 2553 group_->AddUpdateObserver(this); | 2556 group_->AddUpdateObserver(this); |
| 2554 } | 2557 } |
| 2555 | 2558 |
| 2556 void OnUpdateComplete(AppCacheGroup* group) { | 2559 void OnUpdateComplete(AppCacheGroup* group) { |
| 2557 ASSERT_EQ(group_, group); | 2560 ASSERT_EQ(group_, group); |
| 2558 protect_newest_cache_ = group->newest_complete_cache(); | 2561 protect_newest_cache_ = group->newest_complete_cache(); |
| 2559 UpdateFinished(); | 2562 UpdateFinished(); |
| 2560 } | 2563 } |
| 2561 | 2564 |
| 2565 void OnContentBlocked(AppCacheGroup* group) { |
| 2566 } |
| 2567 |
| 2562 void UpdateFinished() { | 2568 void UpdateFinished() { |
| 2563 // We unwind the stack prior to finishing up to let stack-based objects | 2569 // We unwind the stack prior to finishing up to let stack-based objects |
| 2564 // get deleted. | 2570 // get deleted. |
| 2565 MessageLoop::current()->PostTask(FROM_HERE, | 2571 MessageLoop::current()->PostTask(FROM_HERE, |
| 2566 method_factory_.NewRunnableMethod( | 2572 method_factory_.NewRunnableMethod( |
| 2567 &AppCacheUpdateJobTest::UpdateFinishedUnwound)); | 2573 &AppCacheUpdateJobTest::UpdateFinishedUnwound)); |
| 2568 } | 2574 } |
| 2569 | 2575 |
| 2570 void UpdateFinishedUnwound() { | 2576 void UpdateFinishedUnwound() { |
| 2571 EXPECT_EQ(AppCacheGroup::IDLE, group_->update_status()); | 2577 EXPECT_EQ(AppCacheGroup::IDLE, group_->update_status()); |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3175 | 3181 |
| 3176 TEST_F(AppCacheUpdateJobTest, IfNoneMatchRefetch) { | 3182 TEST_F(AppCacheUpdateJobTest, IfNoneMatchRefetch) { |
| 3177 RunTestOnIOThread(&AppCacheUpdateJobTest::IfNoneMatchRefetchTest); | 3183 RunTestOnIOThread(&AppCacheUpdateJobTest::IfNoneMatchRefetchTest); |
| 3178 } | 3184 } |
| 3179 | 3185 |
| 3180 TEST_F(AppCacheUpdateJobTest, MultipleHeadersRefetch) { | 3186 TEST_F(AppCacheUpdateJobTest, MultipleHeadersRefetch) { |
| 3181 RunTestOnIOThread(&AppCacheUpdateJobTest::MultipleHeadersRefetchTest); | 3187 RunTestOnIOThread(&AppCacheUpdateJobTest::MultipleHeadersRefetchTest); |
| 3182 } | 3188 } |
| 3183 | 3189 |
| 3184 } // namespace appcache | 3190 } // namespace appcache |
| OLD | NEW |