Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: content/browser/service_worker/service_worker_job_unittest.cc

Issue 2580793004: service worker: Add CHECKs for investigating null http info bug. (Closed)
Patch Set: Fix foreign fetch Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 #include <tuple> 6 #include <tuple>
7 7
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 version->embedded_worker()->OnNetworkAccessedForScriptLoad(); 857 version->embedded_worker()->OnNetworkAccessedForScriptLoad();
858 } 858 }
859 859
860 int64_t resource_id = storage()->NewResourceId(); 860 int64_t resource_id = storage()->NewResourceId();
861 version->script_cache_map()->NotifyStartedCaching(script, resource_id); 861 version->script_cache_map()->NotifyStartedCaching(script, resource_id);
862 if (!is_update) { 862 if (!is_update) {
863 // Spoof caching the script for the initial version. 863 // Spoof caching the script for the initial version.
864 WriteStringResponse(storage(), resource_id, kMockScriptBody); 864 WriteStringResponse(storage(), resource_id, kMockScriptBody);
865 version->script_cache_map()->NotifyFinishedCaching( 865 version->script_cache_map()->NotifyFinishedCaching(
866 script, kMockScriptSize, net::OK, std::string()); 866 script, kMockScriptSize, net::OK, std::string());
867 version->SetMainScriptHttpResponseInfo(
868 EmbeddedWorkerTestHelper::CreateHttpResponseInfo());
867 } else { 869 } else {
868 if (script.GetOrigin() == kNoChangeOrigin) { 870 if (script.GetOrigin() == kNoChangeOrigin) {
869 // Simulate fetching the updated script and finding it's identical to 871 // Simulate fetching the updated script and finding it's identical to
870 // the incumbent. 872 // the incumbent.
871 version->script_cache_map()->NotifyFinishedCaching( 873 version->script_cache_map()->NotifyFinishedCaching(
872 script, kMockScriptSize, net::ERR_FILE_EXISTS, std::string()); 874 script, kMockScriptSize, net::ERR_FILE_EXISTS, std::string());
875 version->SetMainScriptHttpResponseInfo(
876 EmbeddedWorkerTestHelper::CreateHttpResponseInfo());
873 SimulateWorkerScriptLoaded(embedded_worker_id); 877 SimulateWorkerScriptLoaded(embedded_worker_id);
874 return; 878 return;
875 } 879 }
876 880
877 // Spoof caching the script for the new version. 881 // Spoof caching the script for the new version.
878 WriteStringResponse(storage(), resource_id, "mock_different_script"); 882 WriteStringResponse(storage(), resource_id, "mock_different_script");
879 version->script_cache_map()->NotifyFinishedCaching( 883 version->script_cache_map()->NotifyFinishedCaching(
880 script, kMockScriptSize, net::OK, std::string()); 884 script, kMockScriptSize, net::OK, std::string());
885 version->SetMainScriptHttpResponseInfo(
886 EmbeddedWorkerTestHelper::CreateHttpResponseInfo());
881 } 887 }
882 888
883 EmbeddedWorkerTestHelper::OnStartWorker( 889 EmbeddedWorkerTestHelper::OnStartWorker(
884 embedded_worker_id, version_id, scope, script, pause_after_download); 890 embedded_worker_id, version_id, scope, script, pause_after_download);
885 } 891 }
886 892
887 void OnResumeAfterDownload(int embedded_worker_id) override { 893 void OnResumeAfterDownload(int embedded_worker_id) override {
888 if (!force_start_worker_failure_) { 894 if (!force_start_worker_failure_) {
889 EmbeddedWorkerTestHelper::OnResumeAfterDownload(embedded_worker_id); 895 EmbeddedWorkerTestHelper::OnResumeAfterDownload(embedded_worker_id);
890 } else { 896 } else {
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 EXPECT_EQ(new_version.get(), registration->active_version()); 1753 EXPECT_EQ(new_version.get(), registration->active_version());
1748 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); 1754 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status());
1749 registration->RemoveListener(update_helper); 1755 registration->RemoveListener(update_helper);
1750 } 1756 }
1751 1757
1752 INSTANTIATE_TEST_CASE_P(ServiceWorkerJobTest, 1758 INSTANTIATE_TEST_CASE_P(ServiceWorkerJobTest,
1753 ServiceWorkerJobTestP, 1759 ServiceWorkerJobTestP,
1754 ::testing::Values(false, true)); 1760 ::testing::Values(false, true));
1755 1761
1756 } // namespace content 1762 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698