| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/strings/utf_string_conversions.h" | 22 #include "base/strings/utf_string_conversions.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 26 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 27 #include "content/browser/cache_storage/cache_storage_cache.h" | 27 #include "content/browser/cache_storage/cache_storage_cache.h" |
| 28 #include "content/browser/cache_storage/cache_storage_context_impl.h" | 28 #include "content/browser/cache_storage/cache_storage_context_impl.h" |
| 29 #include "content/browser/cache_storage/cache_storage_manager.h" | 29 #include "content/browser/cache_storage/cache_storage_manager.h" |
| 30 #include "content/browser/service_worker/embedded_worker_instance.h" | 30 #include "content/browser/service_worker/embedded_worker_instance.h" |
| 31 #include "content/browser/service_worker/embedded_worker_registry.h" | 31 #include "content/browser/service_worker/embedded_worker_registry.h" |
| 32 #include "content/browser/service_worker/embedded_worker_status.h" |
| 32 #include "content/browser/service_worker/service_worker_context_core.h" | 33 #include "content/browser/service_worker/service_worker_context_core.h" |
| 33 #include "content/browser/service_worker/service_worker_context_observer.h" | 34 #include "content/browser/service_worker/service_worker_context_observer.h" |
| 34 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 35 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 35 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h" | 36 #include "content/browser/service_worker/service_worker_fetch_dispatcher.h" |
| 36 #include "content/browser/service_worker/service_worker_registration.h" | 37 #include "content/browser/service_worker/service_worker_registration.h" |
| 37 #include "content/browser/service_worker/service_worker_test_utils.h" | 38 #include "content/browser/service_worker/service_worker_test_utils.h" |
| 38 #include "content/browser/service_worker/service_worker_version.h" | 39 #include "content/browser/service_worker/service_worker_version.h" |
| 39 #include "content/common/service_worker/service_worker_messages.h" | 40 #include "content/common/service_worker/service_worker_messages.h" |
| 40 #include "content/common/service_worker/service_worker_status_code.h" | 41 #include "content/common/service_worker/service_worker_status_code.h" |
| 41 #include "content/common/service_worker/service_worker_types.h" | 42 #include "content/common/service_worker/service_worker_types.h" |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 WaitForLoaded wait_for_load(load_run_loop.QuitClosure()); | 974 WaitForLoaded wait_for_load(load_run_loop.QuitClosure()); |
| 974 version_->embedded_worker()->AddListener(&wait_for_load); | 975 version_->embedded_worker()->AddListener(&wait_for_load); |
| 975 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 976 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 976 base::Bind(&self::StartOnIOThread, this, | 977 base::Bind(&self::StartOnIOThread, this, |
| 977 start_run_loop.QuitClosure(), &status)); | 978 start_run_loop.QuitClosure(), &status)); |
| 978 load_run_loop.Run(); | 979 load_run_loop.Run(); |
| 979 version_->embedded_worker()->RemoveListener(&wait_for_load); | 980 version_->embedded_worker()->RemoveListener(&wait_for_load); |
| 980 | 981 |
| 981 // The script has loaded but start has not completed yet. | 982 // The script has loaded but start has not completed yet. |
| 982 ASSERT_EQ(SERVICE_WORKER_ERROR_FAILED, status); | 983 ASSERT_EQ(SERVICE_WORKER_ERROR_FAILED, status); |
| 983 EXPECT_EQ(ServiceWorkerVersion::STARTING, version_->running_status()); | 984 EXPECT_EQ(EmbeddedWorkerStatus::STARTING, version_->running_status()); |
| 984 | 985 |
| 985 // Simulate execution timeout. Use a delay to prevent killing the worker | 986 // Simulate execution timeout. Use a delay to prevent killing the worker |
| 986 // before it's started execution. | 987 // before it's started execution. |
| 987 EXPECT_TRUE(version_->timeout_timer_.IsRunning()); | 988 EXPECT_TRUE(version_->timeout_timer_.IsRunning()); |
| 988 RunOnIOThreadWithDelay(base::Bind(&self::TimeoutWorkerOnIOThread, this), | 989 RunOnIOThreadWithDelay(base::Bind(&self::TimeoutWorkerOnIOThread, this), |
| 989 base::TimeDelta::FromMilliseconds(100)); | 990 base::TimeDelta::FromMilliseconds(100)); |
| 990 start_run_loop.Run(); | 991 start_run_loop.Run(); |
| 991 | 992 |
| 992 EXPECT_EQ(SERVICE_WORKER_ERROR_TIMEOUT, status); | 993 EXPECT_EQ(SERVICE_WORKER_ERROR_TIMEOUT, status); |
| 993 } | 994 } |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 NavigateToTestPage(); | 1867 NavigateToTestPage(); |
| 1867 // The V8 code cache must be stored to the CacheStorage which must be bigger | 1868 // The V8 code cache must be stored to the CacheStorage which must be bigger |
| 1868 // than 12 byte. | 1869 // than 12 byte. |
| 1869 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); | 1870 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); |
| 1870 | 1871 |
| 1871 NavigateToTestPage(); | 1872 NavigateToTestPage(); |
| 1872 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); | 1873 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); |
| 1873 } | 1874 } |
| 1874 | 1875 |
| 1875 } // namespace content | 1876 } // namespace content |
| OLD | NEW |