OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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> |
| 6 |
5 #include <set> | 7 #include <set> |
6 #include <string> | 8 #include <string> |
7 #include <vector> | 9 #include <vector> |
8 | 10 |
9 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/macros.h" |
10 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
11 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
12 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
13 #include "content/browser/background_sync/background_sync_manager.h" | 16 #include "content/browser/background_sync/background_sync_manager.h" |
14 #include "content/browser/background_sync/background_sync_network_observer.h" | 17 #include "content/browser/background_sync/background_sync_network_observer.h" |
15 #include "content/browser/background_sync/background_sync_registration_handle.h" | 18 #include "content/browser/background_sync/background_sync_registration_handle.h" |
16 #include "content/browser/background_sync/background_sync_status.h" | 19 #include "content/browser/background_sync/background_sync_status.h" |
17 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 20 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
18 #include "content/browser/service_worker/service_worker_registration.h" | 21 #include "content/browser/service_worker/service_worker_registration.h" |
19 #include "content/public/browser/background_sync_context.h" | 22 #include "content/public/browser/background_sync_context.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 BACKGROUND_SYNC_STATE_PENDING); | 75 BACKGROUND_SYNC_STATE_PENDING); |
73 } | 76 } |
74 | 77 |
75 void OneShotPendingDidGetSWRegistration( | 78 void OneShotPendingDidGetSWRegistration( |
76 const scoped_refptr<BackgroundSyncContext> sync_context, | 79 const scoped_refptr<BackgroundSyncContext> sync_context, |
77 const std::string& tag, | 80 const std::string& tag, |
78 const base::Callback<void(bool)>& callback, | 81 const base::Callback<void(bool)>& callback, |
79 ServiceWorkerStatusCode status, | 82 ServiceWorkerStatusCode status, |
80 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 83 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
81 ASSERT_EQ(SERVICE_WORKER_OK, status); | 84 ASSERT_EQ(SERVICE_WORKER_OK, status); |
82 int64 service_worker_id = registration->id(); | 85 int64_t service_worker_id = registration->id(); |
83 BackgroundSyncManager* sync_manager = sync_context->background_sync_manager(); | 86 BackgroundSyncManager* sync_manager = sync_context->background_sync_manager(); |
84 sync_manager->GetRegistration( | 87 sync_manager->GetRegistration( |
85 service_worker_id, tag, SYNC_ONE_SHOT, | 88 service_worker_id, tag, SYNC_ONE_SHOT, |
86 base::Bind(&OneShotPendingDidGetSyncRegistration, callback)); | 89 base::Bind(&OneShotPendingDidGetSyncRegistration, callback)); |
87 } | 90 } |
88 | 91 |
89 void OneShotPendingOnIOThread( | 92 void OneShotPendingOnIOThread( |
90 const scoped_refptr<BackgroundSyncContext> sync_context, | 93 const scoped_refptr<BackgroundSyncContext> sync_context, |
91 const scoped_refptr<ServiceWorkerContextWrapper> sw_context, | 94 const scoped_refptr<ServiceWorkerContextWrapper> sw_context, |
92 const std::string& tag, | 95 const std::string& tag, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 run_loop.QuitClosure()); | 240 run_loop.QuitClosure()); |
238 | 241 |
239 run_loop.Run(); | 242 run_loop.Run(); |
240 } | 243 } |
241 | 244 |
242 void BackgroundSyncBrowserTest::ClearStoragePartitionData() { | 245 void BackgroundSyncBrowserTest::ClearStoragePartitionData() { |
243 // Clear data from the storage partition. Parameters are set to clear data | 246 // Clear data from the storage partition. Parameters are set to clear data |
244 // for service workers, for all origins, for an unbounded time range. | 247 // for service workers, for all origins, for an unbounded time range. |
245 StoragePartition* storage = GetStorage(); | 248 StoragePartition* storage = GetStorage(); |
246 | 249 |
247 uint32 storage_partition_mask = | 250 uint32_t storage_partition_mask = |
248 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; | 251 StoragePartition::REMOVE_DATA_MASK_SERVICE_WORKERS; |
249 uint32 quota_storage_mask = StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL; | 252 uint32_t quota_storage_mask = |
| 253 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL; |
250 const GURL& delete_origin = GURL(); | 254 const GURL& delete_origin = GURL(); |
251 const base::Time delete_begin = base::Time(); | 255 const base::Time delete_begin = base::Time(); |
252 base::Time delete_end = base::Time::Max(); | 256 base::Time delete_end = base::Time::Max(); |
253 | 257 |
254 base::RunLoop run_loop; | 258 base::RunLoop run_loop; |
255 | 259 |
256 storage->ClearData(storage_partition_mask, quota_storage_mask, delete_origin, | 260 storage->ClearData(storage_partition_mask, quota_storage_mask, delete_origin, |
257 StoragePartition::OriginMatcherFunction(), delete_begin, | 261 StoragePartition::OriginMatcherFunction(), delete_begin, |
258 delete_end, run_loop.QuitClosure()); | 262 delete_end, run_loop.QuitClosure()); |
259 | 263 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 GURL url = alt_server.GetURL(kRegisterSyncURL); | 659 GURL url = alt_server.GetURL(kRegisterSyncURL); |
656 EXPECT_TRUE( | 660 EXPECT_TRUE( |
657 RunScript(BuildScriptString("registerOneShotFromCrossOriginServiceWorker", | 661 RunScript(BuildScriptString("registerOneShotFromCrossOriginServiceWorker", |
658 url.spec()), | 662 url.spec()), |
659 &script_result)); | 663 &script_result)); |
660 EXPECT_EQ(BuildExpectedResult("worker", "failed to register sync"), | 664 EXPECT_EQ(BuildExpectedResult("worker", "failed to register sync"), |
661 script_result); | 665 script_result); |
662 } | 666 } |
663 | 667 |
664 } // namespace content | 668 } // namespace content |
OLD | NEW |