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 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3011 } | 3011 } |
3012 | 3012 |
3013 void WaitForUpdateToFinish() { | 3013 void WaitForUpdateToFinish() { |
3014 if (group_->update_status() == AppCacheGroup::IDLE) | 3014 if (group_->update_status() == AppCacheGroup::IDLE) |
3015 UpdateFinished(); | 3015 UpdateFinished(); |
3016 else | 3016 else |
3017 group_->AddUpdateObserver(this); | 3017 group_->AddUpdateObserver(this); |
3018 } | 3018 } |
3019 | 3019 |
3020 virtual void OnUpdateComplete(AppCacheGroup* group) OVERRIDE { | 3020 virtual void OnUpdateComplete(AppCacheGroup* group) OVERRIDE { |
3021 ASSERT_EQ(group_, group); | 3021 ASSERT_EQ(group_.get(), group); |
3022 protect_newest_cache_ = group->newest_complete_cache(); | 3022 protect_newest_cache_ = group->newest_complete_cache(); |
3023 UpdateFinished(); | 3023 UpdateFinished(); |
3024 } | 3024 } |
3025 | 3025 |
3026 void UpdateFinished() { | 3026 void UpdateFinished() { |
3027 // We unwind the stack prior to finishing up to let stack-based objects | 3027 // We unwind the stack prior to finishing up to let stack-based objects |
3028 // get deleted. | 3028 // get deleted. |
3029 base::MessageLoop::current()->PostTask( | 3029 base::MessageLoop::current()->PostTask( |
3030 FROM_HERE, | 3030 FROM_HERE, |
3031 base::Bind(&AppCacheUpdateJobTest::UpdateFinishedUnwound, | 3031 base::Bind(&AppCacheUpdateJobTest::UpdateFinishedUnwound, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3185 EXPECT_EQ(frontend->expected_error_message_, | 3185 EXPECT_EQ(frontend->expected_error_message_, |
3186 frontend->error_message_); | 3186 frontend->error_message_); |
3187 } | 3187 } |
3188 } | 3188 } |
3189 | 3189 |
3190 // Verify expected cache contents last as some checks are asserts | 3190 // Verify expected cache contents last as some checks are asserts |
3191 // and will abort the test if they fail. | 3191 // and will abort the test if they fail. |
3192 if (tested_manifest_) { | 3192 if (tested_manifest_) { |
3193 AppCache* cache = group_->newest_complete_cache(); | 3193 AppCache* cache = group_->newest_complete_cache(); |
3194 ASSERT_TRUE(cache != NULL); | 3194 ASSERT_TRUE(cache != NULL); |
3195 EXPECT_EQ(group_, cache->owning_group()); | 3195 EXPECT_EQ(group_.get(), cache->owning_group()); |
3196 EXPECT_TRUE(cache->is_complete()); | 3196 EXPECT_TRUE(cache->is_complete()); |
3197 | 3197 |
3198 switch (tested_manifest_) { | 3198 switch (tested_manifest_) { |
3199 case MANIFEST1: | 3199 case MANIFEST1: |
3200 VerifyManifest1(cache); | 3200 VerifyManifest1(cache); |
3201 break; | 3201 break; |
3202 case MANIFEST_MERGED_TYPES: | 3202 case MANIFEST_MERGED_TYPES: |
3203 VerifyManifestMergedTypes(cache); | 3203 VerifyManifestMergedTypes(cache); |
3204 break; | 3204 break; |
3205 case EMPTY_MANIFEST: | 3205 case EMPTY_MANIFEST: |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3687 | 3687 |
3688 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { | 3688 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { |
3689 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); | 3689 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); |
3690 } | 3690 } |
3691 | 3691 |
3692 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { | 3692 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { |
3693 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); | 3693 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); |
3694 } | 3694 } |
3695 | 3695 |
3696 } // namespace content | 3696 } // namespace content |
OLD | NEW |