| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/background_fetch/background_fetch_event_dispatcher.h" | 5 #include "content/browser/background_fetch/background_fetch_event_dispatcher.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 ASSERT_TRUE(embedded_worker_test_helper()->last_fetches().has_value()); | 178 ASSERT_TRUE(embedded_worker_test_helper()->last_fetches().has_value()); |
| 179 EXPECT_EQ(fetches.size(), | 179 EXPECT_EQ(fetches.size(), |
| 180 embedded_worker_test_helper()->last_fetches()->size()); | 180 embedded_worker_test_helper()->last_fetches()->size()); |
| 181 | 181 |
| 182 histogram_tester_.ExpectUniqueSample( | 182 histogram_tester_.ExpectUniqueSample( |
| 183 "BackgroundFetch.EventDispatchResult.FailEvent", | 183 "BackgroundFetch.EventDispatchResult.FailEvent", |
| 184 BackgroundFetchEventDispatcher::DISPATCH_RESULT_SUCCESS, 1); | 184 BackgroundFetchEventDispatcher::DISPATCH_RESULT_SUCCESS, 1); |
| 185 | 185 |
| 186 fetches.push_back(BackgroundFetchSettledFetch()); | 186 fetches.push_back(BackgroundFetchSettledFetch()); |
| 187 | 187 |
| 188 embedded_worker_test_helper()->set_fail_fail_event(true); | 188 embedded_worker_test_helper()->set_fail_fetch_fail_event(true); |
| 189 | 189 |
| 190 BackgroundFetchRegistrationId second_registration_id( | 190 BackgroundFetchRegistrationId second_registration_id( |
| 191 registration_id.service_worker_registration_id(), | 191 registration_id.service_worker_registration_id(), |
| 192 registration_id.origin(), kExampleTag2); | 192 registration_id.origin(), kExampleTag2); |
| 193 | 193 |
| 194 { | 194 { |
| 195 base::RunLoop run_loop; | 195 base::RunLoop run_loop; |
| 196 event_dispatcher_.DispatchBackgroundFetchFailEvent( | 196 event_dispatcher_.DispatchBackgroundFetchFailEvent( |
| 197 second_registration_id, fetches, run_loop.QuitClosure()); | 197 second_registration_id, fetches, run_loop.QuitClosure()); |
| 198 | 198 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 histogram_tester_.ExpectBucketCount( | 272 histogram_tester_.ExpectBucketCount( |
| 273 "BackgroundFetch.EventDispatchResult.FetchedEvent", | 273 "BackgroundFetch.EventDispatchResult.FetchedEvent", |
| 274 BackgroundFetchEventDispatcher::DISPATCH_RESULT_CANNOT_DISPATCH_EVENT, 1); | 274 BackgroundFetchEventDispatcher::DISPATCH_RESULT_CANNOT_DISPATCH_EVENT, 1); |
| 275 histogram_tester_.ExpectUniqueSample( | 275 histogram_tester_.ExpectUniqueSample( |
| 276 "BackgroundFetch.EventDispatchFailure.Dispatch.FetchedEvent", | 276 "BackgroundFetch.EventDispatchFailure.Dispatch.FetchedEvent", |
| 277 SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, 1); | 277 SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, 1); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace | 280 } // namespace |
| 281 } // namespace content | 281 } // namespace content |
| OLD | NEW |