| 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> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> |
| 7 #include <set> | 8 #include <set> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 15 #include "base/task_runner_util.h" | 16 #include "base/task_runner_util.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 bool* result_out, | 67 bool* result_out, |
| 67 bool result) { | 68 bool result) { |
| 68 *result_out = result; | 69 *result_out = result; |
| 69 task_runner->PostTask(FROM_HERE, quit); | 70 task_runner->PostTask(FROM_HERE, quit); |
| 70 } | 71 } |
| 71 | 72 |
| 72 void RegistrationPendingDidGetSyncRegistration( | 73 void RegistrationPendingDidGetSyncRegistration( |
| 73 const std::string& tag, | 74 const std::string& tag, |
| 74 const base::Callback<void(bool)>& callback, | 75 const base::Callback<void(bool)>& callback, |
| 75 BackgroundSyncStatus error_type, | 76 BackgroundSyncStatus error_type, |
| 76 std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> registrations) { | 77 std::unique_ptr<std::vector<std::unique_ptr<BackgroundSyncRegistration>>> |
| 78 registrations) { |
| 77 ASSERT_EQ(BACKGROUND_SYNC_STATUS_OK, error_type); | 79 ASSERT_EQ(BACKGROUND_SYNC_STATUS_OK, error_type); |
| 78 // Find the right registration in the list and check its status. | 80 // Find the right registration in the list and check its status. |
| 79 for (const BackgroundSyncRegistration* registration : *registrations) { | 81 for (const auto& registration : *registrations) { |
| 80 if (registration->options()->tag == tag) { | 82 if (registration->options()->tag == tag) { |
| 81 callback.Run(registration->sync_state() == | 83 callback.Run(registration->sync_state() == |
| 82 blink::mojom::BackgroundSyncState::PENDING); | 84 blink::mojom::BackgroundSyncState::PENDING); |
| 83 return; | 85 return; |
| 84 } | 86 } |
| 85 } | 87 } |
| 86 ADD_FAILURE() << "Registration should exist"; | 88 ADD_FAILURE() << "Registration should exist"; |
| 87 } | 89 } |
| 88 | 90 |
| 89 void RegistrationPendingDidGetSWRegistration( | 91 void RegistrationPendingDidGetSWRegistration( |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 IN_PROC_BROWSER_TEST_F(BackgroundSyncBrowserTest, | 683 IN_PROC_BROWSER_TEST_F(BackgroundSyncBrowserTest, |
| 682 RegisterFromServiceWorkerWithoutMainFrameHost) { | 684 RegisterFromServiceWorkerWithoutMainFrameHost) { |
| 683 std::string script_result; | 685 std::string script_result; |
| 684 EXPECT_TRUE( | 686 EXPECT_TRUE( |
| 685 RegisterFromCrossOriginFrame(kRegisterSyncFromSWURL, &script_result)); | 687 RegisterFromCrossOriginFrame(kRegisterSyncFromSWURL, &script_result)); |
| 686 EXPECT_EQ(BuildExpectedResult("frame", "failed to register sync"), | 688 EXPECT_EQ(BuildExpectedResult("frame", "failed to register sync"), |
| 687 script_result); | 689 script_result); |
| 688 } | 690 } |
| 689 | 691 |
| 690 } // namespace content | 692 } // namespace content |
| OLD | NEW |