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 <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 bool* result_out, | 65 bool* result_out, |
66 bool result) { | 66 bool result) { |
67 *result_out = result; | 67 *result_out = result; |
68 task_runner->PostTask(FROM_HERE, quit); | 68 task_runner->PostTask(FROM_HERE, quit); |
69 } | 69 } |
70 | 70 |
71 void RegistrationPendingDidGetSyncRegistration( | 71 void RegistrationPendingDidGetSyncRegistration( |
72 const std::string& tag, | 72 const std::string& tag, |
73 const base::Callback<void(bool)>& callback, | 73 const base::Callback<void(bool)>& callback, |
74 BackgroundSyncStatus error_type, | 74 BackgroundSyncStatus error_type, |
75 scoped_ptr<ScopedVector<BackgroundSyncRegistration>> registrations) { | 75 std::unique_ptr<ScopedVector<BackgroundSyncRegistration>> registrations) { |
76 ASSERT_EQ(BACKGROUND_SYNC_STATUS_OK, error_type); | 76 ASSERT_EQ(BACKGROUND_SYNC_STATUS_OK, error_type); |
77 // Find the right registration in the list and check its status. | 77 // Find the right registration in the list and check its status. |
78 for (const BackgroundSyncRegistration* registration : *registrations) { | 78 for (const BackgroundSyncRegistration* registration : *registrations) { |
79 if (registration->options()->tag == tag) { | 79 if (registration->options()->tag == tag) { |
80 callback.Run(registration->sync_state() == | 80 callback.Run(registration->sync_state() == |
81 mojom::BackgroundSyncState::PENDING); | 81 mojom::BackgroundSyncState::PENDING); |
82 return; | 82 return; |
83 } | 83 } |
84 } | 84 } |
85 ADD_FAILURE() << "Registration should exist"; | 85 ADD_FAILURE() << "Registration should exist"; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 bool MatchTags(const std::string& script_result, | 200 bool MatchTags(const std::string& script_result, |
201 const std::vector<std::string>& expected_tags); | 201 const std::vector<std::string>& expected_tags); |
202 bool GetTags(const std::vector<std::string>& expected_tags); | 202 bool GetTags(const std::vector<std::string>& expected_tags); |
203 bool GetTagsFromServiceWorker(const std::vector<std::string>& expected_tags); | 203 bool GetTagsFromServiceWorker(const std::vector<std::string>& expected_tags); |
204 bool CompleteDelayedSyncEvent(); | 204 bool CompleteDelayedSyncEvent(); |
205 bool RejectDelayedSyncEvent(); | 205 bool RejectDelayedSyncEvent(); |
206 | 206 |
207 net::EmbeddedTestServer* https_server() { return https_server_.get(); } | 207 net::EmbeddedTestServer* https_server() { return https_server_.get(); } |
208 | 208 |
209 private: | 209 private: |
210 scoped_ptr<net::EmbeddedTestServer> https_server_; | 210 std::unique_ptr<net::EmbeddedTestServer> https_server_; |
211 Shell* shell_ = nullptr; | 211 Shell* shell_ = nullptr; |
212 | 212 |
213 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncBrowserTest); | 213 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncBrowserTest); |
214 }; | 214 }; |
215 | 215 |
216 bool BackgroundSyncBrowserTest::RegistrationPending(const std::string& tag) { | 216 bool BackgroundSyncBrowserTest::RegistrationPending(const std::string& tag) { |
217 bool is_pending; | 217 bool is_pending; |
218 base::RunLoop run_loop; | 218 base::RunLoop run_loop; |
219 | 219 |
220 StoragePartition* storage = GetStorage(); | 220 StoragePartition* storage = GetStorage(); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 IN_PROC_BROWSER_TEST_F(BackgroundSyncBrowserTest, | 679 IN_PROC_BROWSER_TEST_F(BackgroundSyncBrowserTest, |
680 RegisterFromServiceWorkerWithoutMainFrameHost) { | 680 RegisterFromServiceWorkerWithoutMainFrameHost) { |
681 std::string script_result; | 681 std::string script_result; |
682 EXPECT_TRUE( | 682 EXPECT_TRUE( |
683 RegisterFromCrossOriginFrame(kRegisterSyncFromSWURL, &script_result)); | 683 RegisterFromCrossOriginFrame(kRegisterSyncFromSWURL, &script_result)); |
684 EXPECT_EQ(BuildExpectedResult("frame", "failed to register sync"), | 684 EXPECT_EQ(BuildExpectedResult("frame", "failed to register sync"), |
685 script_result); | 685 script_result); |
686 } | 686 } |
687 | 687 |
688 } // namespace content | 688 } // namespace content |
OLD | NEW |