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 "content/browser/service_worker/service_worker_controllee_request_handl
er.h" | 5 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 | 36 |
37 namespace { | 37 namespace { |
38 | 38 |
39 int kMockProviderId = 1; | 39 int kMockProviderId = 1; |
40 | 40 |
41 } | 41 } |
42 | 42 |
43 class FailureHelper : public EmbeddedWorkerTestHelper { | |
44 public: | |
45 FailureHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} | |
46 ~FailureHelper() override {} | |
47 | |
48 protected: | |
49 void OnStartWorker( | |
50 int embedded_worker_id, | |
51 int64_t service_worker_version_id, | |
52 const GURL& scope, | |
53 const GURL& script_url, | |
54 bool pause_after_download, | |
55 mojom::ServiceWorkerEventDispatcherRequest request) override { | |
56 SimulateWorkerStopped(embedded_worker_id); | |
57 } | |
58 }; | |
59 | |
60 class ServiceWorkerControlleeRequestHandlerTest : public testing::Test { | 43 class ServiceWorkerControlleeRequestHandlerTest : public testing::Test { |
61 public: | 44 public: |
62 class ServiceWorkerRequestTestResources { | 45 class ServiceWorkerRequestTestResources { |
63 public: | 46 public: |
64 ServiceWorkerRequestTestResources( | 47 ServiceWorkerRequestTestResources( |
65 ServiceWorkerControlleeRequestHandlerTest* test, | 48 ServiceWorkerControlleeRequestHandlerTest* test, |
66 const GURL& url, | 49 const GURL& url, |
67 ResourceType type, | 50 ResourceType type, |
68 FetchRequestMode fetch_type = FETCH_REQUEST_MODE_NO_CORS) | 51 FetchRequestMode fetch_type = FETCH_REQUEST_MODE_NO_CORS) |
69 : test_(test), | 52 : test_(test), |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); | 366 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); |
384 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); | 367 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); |
385 | 368 |
386 base::RunLoop().RunUntilIdle(); | 369 base::RunLoop().RunUntilIdle(); |
387 | 370 |
388 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); | 371 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); |
389 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); | 372 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); |
390 } | 373 } |
391 | 374 |
392 } // namespace content | 375 } // namespace content |
OLD | NEW |