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

Side by Side Diff: content/browser/background_sync/background_sync_service_impl_unittest.cc

Issue 1423313006: Add browser tests for clearing sync registrations with site data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove TODO Created 5 years, 1 month 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
« no previous file with comments | « content/browser/background_sync/background_sync_network_observer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/background_sync/background_sync_service_impl.h" 5 #include "content/browser/background_sync/background_sync_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Tests do not expect the sync event to fire immediately after 146 // Tests do not expect the sync event to fire immediately after
147 // register (and cleanup up the sync registrations). Prevent the sync 147 // register (and cleanup up the sync registrations). Prevent the sync
148 // event from firing by setting the network state to have no connection. 148 // event from firing by setting the network state to have no connection.
149 // NOTE: The setup of the network connection must happen after the 149 // NOTE: The setup of the network connection must happen after the
150 // BackgroundSyncManager has been setup, including any asynchronous 150 // BackgroundSyncManager has been setup, including any asynchronous
151 // initialization. 151 // initialization.
152 base::RunLoop().RunUntilIdle(); 152 base::RunLoop().RunUntilIdle();
153 BackgroundSyncNetworkObserver* network_observer = 153 BackgroundSyncNetworkObserver* network_observer =
154 background_sync_context_->background_sync_manager() 154 background_sync_context_->background_sync_manager()
155 ->GetNetworkObserverForTesting(); 155 ->GetNetworkObserverForTesting();
156 network_observer->NotifyManagerIfNetworkChanged( 156 network_observer->NotifyManagerIfNetworkChangedForTesting(
157 net::NetworkChangeNotifier::CONNECTION_NONE); 157 net::NetworkChangeNotifier::CONNECTION_NONE);
158 base::RunLoop().RunUntilIdle(); 158 base::RunLoop().RunUntilIdle();
159 } 159 }
160 160
161 void CreateServiceWorkerRegistration() { 161 void CreateServiceWorkerRegistration() {
162 bool called = false; 162 bool called = false;
163 embedded_worker_helper_->context()->RegisterServiceWorker( 163 embedded_worker_helper_->context()->RegisterServiceWorker(
164 GURL(kServiceWorkerPattern), GURL(kServiceWorkerScript), NULL, 164 GURL(kServiceWorkerPattern), GURL(kServiceWorkerScript), NULL,
165 base::Bind(&RegisterServiceWorkerCallback, &called, 165 base::Bind(&RegisterServiceWorkerCallback, &called,
166 &sw_registration_id_)); 166 &sw_registration_id_));
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 446
447 NotifyWhenDone(reg->handle_id, 447 NotifyWhenDone(reg->handle_id,
448 base::Bind(&ErrorAndStateCallback, &notify_done_called, 448 base::Bind(&ErrorAndStateCallback, &notify_done_called,
449 &notify_done_error, &notify_done_sync_state)); 449 &notify_done_error, &notify_done_sync_state));
450 EXPECT_TRUE(notify_done_called); 450 EXPECT_TRUE(notify_done_called);
451 EXPECT_EQ(BACKGROUND_SYNC_ERROR_NONE, notify_done_error); 451 EXPECT_EQ(BACKGROUND_SYNC_ERROR_NONE, notify_done_error);
452 EXPECT_EQ(BACKGROUND_SYNC_STATE_UNREGISTERED, notify_done_sync_state); 452 EXPECT_EQ(BACKGROUND_SYNC_STATE_UNREGISTERED, notify_done_sync_state);
453 } 453 }
454 454
455 } // namespace content 455 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/background_sync/background_sync_network_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698