Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: content/browser/service_worker/service_worker_job_unittest.cc

Issue 2181553003: Stop passing const-reference of SWRegistration in all GetRegistrationsCallbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ServiceWorkerContextCore::DidFindRegistrationForCheckHasServiceWorker() Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 #include <tuple> 6 #include <tuple>
7 7
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 EXPECT_EQ(expected_status, status); 51 EXPECT_EQ(expected_status, status);
52 *called = true; 52 *called = true;
53 *registration_out = registration; 53 *registration_out = registration;
54 } 54 }
55 55
56 void SaveFoundRegistrationCallback( 56 void SaveFoundRegistrationCallback(
57 ServiceWorkerStatusCode expected_status, 57 ServiceWorkerStatusCode expected_status,
58 bool* called, 58 bool* called,
59 scoped_refptr<ServiceWorkerRegistration>* registration, 59 scoped_refptr<ServiceWorkerRegistration>* registration,
60 ServiceWorkerStatusCode status, 60 ServiceWorkerStatusCode status,
61 const scoped_refptr<ServiceWorkerRegistration>& result) { 61 scoped_refptr<ServiceWorkerRegistration> result) {
62 EXPECT_EQ(expected_status, status); 62 EXPECT_EQ(expected_status, status);
63 *called = true; 63 *called = true;
64 *registration = result; 64 *registration = std::move(result);
65 } 65 }
66 66
67 // Creates a callback which both keeps track of if it's been called, 67 // Creates a callback which both keeps track of if it's been called,
68 // as well as the resulting registration. Whent the callback is fired, 68 // as well as the resulting registration. Whent the callback is fired,
69 // it ensures that the resulting status matches the expectation. 69 // it ensures that the resulting status matches the expectation.
70 // 'called' is useful for making sure a sychronous callback is or 70 // 'called' is useful for making sure a sychronous callback is or
71 // isn't called. 71 // isn't called.
72 ServiceWorkerRegisterJob::RegistrationCallback SaveRegistration( 72 ServiceWorkerRegisterJob::RegistrationCallback SaveRegistration(
73 ServiceWorkerStatusCode expected_status, 73 ServiceWorkerStatusCode expected_status,
74 bool* called, 74 bool* called,
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 // should not be promoted to ACTIVATED because failure occur 1689 // should not be promoted to ACTIVATED because failure occur
1690 // during shutdown. 1690 // during shutdown.
1691 runner->RunUntilIdle(); 1691 runner->RunUntilIdle();
1692 base::RunLoop().RunUntilIdle(); 1692 base::RunLoop().RunUntilIdle();
1693 EXPECT_EQ(new_version.get(), registration->active_version()); 1693 EXPECT_EQ(new_version.get(), registration->active_version());
1694 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status()); 1694 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, new_version->status());
1695 registration->RemoveListener(update_helper); 1695 registration->RemoveListener(update_helper);
1696 } 1696 }
1697 1697
1698 } // namespace content 1698 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698