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

Side by Side Diff: sync/internal_api/http_bridge_unittest.cc

Issue 503903002: Remove implicit conversions from scoped_refptr to T* in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « sync/internal_api/http_bridge.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/synchronization/waitable_event.h" 5 #include "base/synchronization/waitable_event.h"
6 #include "base/threading/thread.h" 6 #include "base/threading/thread.h"
7 #include "net/test/spawned_test_server/spawned_test_server.h" 7 #include "net/test/spawned_test_server/spawned_test_server.h"
8 #include "net/url_request/test_url_fetcher_factory.h" 8 #include "net/url_request/test_url_fetcher_factory.h"
9 #include "net/url_request/url_fetcher_delegate.h" 9 #include "net/url_request/url_fetcher_delegate.h"
10 #include "net/url_request/url_request_test_util.h" 10 #include "net/url_request/url_request_test_util.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 TEST_F(SyncHttpBridgeTest, EarlyAbortFactory) { 492 TEST_F(SyncHttpBridgeTest, EarlyAbortFactory) {
493 // In a real scenario, the following would happen on many threads. For 493 // In a real scenario, the following would happen on many threads. For
494 // simplicity, this test uses only one thread. 494 // simplicity, this test uses only one thread.
495 495
496 scoped_refptr<net::URLRequestContextGetter> baseline_context_getter( 496 scoped_refptr<net::URLRequestContextGetter> baseline_context_getter(
497 new net::TestURLRequestContextGetter(io_thread()->message_loop_proxy())); 497 new net::TestURLRequestContextGetter(io_thread()->message_loop_proxy()));
498 CancelationSignal release_request_context_signal; 498 CancelationSignal release_request_context_signal;
499 499
500 // UI Thread: Initialize the HttpBridgeFactory. The next step would be to 500 // UI Thread: Initialize the HttpBridgeFactory. The next step would be to
501 // post a task to SBH::Core to have it initialized. 501 // post a task to SBH::Core to have it initialized.
502 scoped_ptr<syncer::HttpBridgeFactory> factory(new HttpBridgeFactory( 502 scoped_ptr<syncer::HttpBridgeFactory> factory(
503 baseline_context_getter, 503 new HttpBridgeFactory(baseline_context_getter.get(),
504 NetworkTimeUpdateCallback(), 504 NetworkTimeUpdateCallback(),
505 &release_request_context_signal)); 505 &release_request_context_signal));
506 506
507 // UI Thread: A very early shutdown request arrives and executes on the UI 507 // UI Thread: A very early shutdown request arrives and executes on the UI
508 // thread before the posted sync thread task is run. 508 // thread before the posted sync thread task is run.
509 release_request_context_signal.Signal(); 509 release_request_context_signal.Signal();
510 510
511 // Sync thread: Finally run the posted task, only to find that our 511 // Sync thread: Finally run the posted task, only to find that our
512 // HttpBridgeFactory has been neutered. Should not crash. 512 // HttpBridgeFactory has been neutered. Should not crash.
513 factory->Init("TestUserAgent"); 513 factory->Init("TestUserAgent");
514 514
515 // At this point, attempting to use the factory would trigger a crash. Both 515 // At this point, attempting to use the factory would trigger a crash. Both
516 // this test and the real world code should make sure this never happens. 516 // this test and the real world code should make sure this never happens.
517 }; 517 };
518 518
519 } // namespace syncer 519 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/http_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698