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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 WaitForLoaded wait_for_load(load_run_loop.QuitClosure()); | 973 WaitForLoaded wait_for_load(load_run_loop.QuitClosure()); |
973 version_->embedded_worker()->AddListener(&wait_for_load); | 974 version_->embedded_worker()->AddListener(&wait_for_load); |
974 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 975 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
975 base::Bind(&self::StartOnIOThread, this, | 976 base::Bind(&self::StartOnIOThread, this, |
976 start_run_loop.QuitClosure(), &status)); | 977 start_run_loop.QuitClosure(), &status)); |
977 load_run_loop.Run(); | 978 load_run_loop.Run(); |
978 version_->embedded_worker()->RemoveListener(&wait_for_load); | 979 version_->embedded_worker()->RemoveListener(&wait_for_load); |
979 | 980 |
980 // The script has loaded but start has not completed yet. | 981 // The script has loaded but start has not completed yet. |
981 ASSERT_EQ(SERVICE_WORKER_ERROR_FAILED, status); | 982 ASSERT_EQ(SERVICE_WORKER_ERROR_FAILED, status); |
982 EXPECT_EQ(ServiceWorkerVersion::STARTING, version_->running_status()); | 983 EXPECT_EQ(EmbeddedWorkerStatus::STARTING, version_->running_status()); |
983 | 984 |
984 // Simulate execution timeout. Use a delay to prevent killing the worker | 985 // Simulate execution timeout. Use a delay to prevent killing the worker |
985 // before it's started execution. | 986 // before it's started execution. |
986 EXPECT_TRUE(version_->timeout_timer_.IsRunning()); | 987 EXPECT_TRUE(version_->timeout_timer_.IsRunning()); |
987 RunOnIOThreadWithDelay(base::Bind(&self::TimeoutWorkerOnIOThread, this), | 988 RunOnIOThreadWithDelay(base::Bind(&self::TimeoutWorkerOnIOThread, this), |
988 base::TimeDelta::FromMilliseconds(100)); | 989 base::TimeDelta::FromMilliseconds(100)); |
989 start_run_loop.Run(); | 990 start_run_loop.Run(); |
990 | 991 |
991 EXPECT_EQ(SERVICE_WORKER_ERROR_TIMEOUT, status); | 992 EXPECT_EQ(SERVICE_WORKER_ERROR_TIMEOUT, status); |
992 } | 993 } |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 NavigateToTestPage(); | 1866 NavigateToTestPage(); |
1866 // The V8 code cache must be stored to the CacheStorage which must be bigger | 1867 // The V8 code cache must be stored to the CacheStorage which must be bigger |
1867 // than 12 byte. | 1868 // than 12 byte. |
1868 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); | 1869 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); |
1869 | 1870 |
1870 NavigateToTestPage(); | 1871 NavigateToTestPage(); |
1871 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); | 1872 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); |
1872 } | 1873 } |
1873 | 1874 |
1874 } // namespace content | 1875 } // namespace content |
OLD | NEW |