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

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

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « storage/browser/quota/quota_manager_proxy.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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/bit_cast.h" 8 #include "base/bit_cast.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 new net::TestURLRequestContextGetter(io_thread()->task_runner())); 378 new net::TestURLRequestContextGetter(io_thread()->task_runner()));
379 scoped_refptr<ShuntedHttpBridge> http_bridge( 379 scoped_refptr<ShuntedHttpBridge> http_bridge(
380 new ShuntedHttpBridge(ctx_getter.get(), this, true)); 380 new ShuntedHttpBridge(ctx_getter.get(), this, true));
381 http_bridge->SetURL("http://www.google.com", 9999); 381 http_bridge->SetURL("http://www.google.com", 9999);
382 http_bridge->SetPostPayload("text/plain", 2, " "); 382 http_bridge->SetPostPayload("text/plain", 2, " ");
383 383
384 int os_error = 0; 384 int os_error = 0;
385 int response_code = 0; 385 int response_code = 0;
386 386
387 io_thread()->task_runner()->PostTask( 387 io_thread()->task_runner()->PostTask(
388 FROM_HERE, 388 FROM_HERE, base::Bind(&MAYBE_SyncHttpBridgeTest::Abort,
389 base::Bind(&MAYBE_SyncHttpBridgeTest::Abort, http_bridge)); 389 base::RetainedRef(http_bridge)));
390 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code); 390 bool success = http_bridge->MakeSynchronousPost(&os_error, &response_code);
391 EXPECT_FALSE(success); 391 EXPECT_FALSE(success);
392 EXPECT_EQ(net::ERR_ABORTED, os_error); 392 EXPECT_EQ(net::ERR_ABORTED, os_error);
393 } 393 }
394 394
395 TEST_F(MAYBE_SyncHttpBridgeTest, AbortLate) { 395 TEST_F(MAYBE_SyncHttpBridgeTest, AbortLate) {
396 scoped_refptr<net::URLRequestContextGetter> ctx_getter( 396 scoped_refptr<net::URLRequestContextGetter> ctx_getter(
397 new net::TestURLRequestContextGetter(io_thread()->task_runner())); 397 new net::TestURLRequestContextGetter(io_thread()->task_runner()));
398 scoped_refptr<ShuntedHttpBridge> http_bridge( 398 scoped_refptr<ShuntedHttpBridge> http_bridge(
399 new ShuntedHttpBridge(ctx_getter.get(), this, false)); 399 new ShuntedHttpBridge(ctx_getter.get(), this, false));
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 573
574 // Sync thread: Finally run the posted task, only to find that our 574 // Sync thread: Finally run the posted task, only to find that our
575 // HttpBridgeFactory has been neutered. Should not crash. 575 // HttpBridgeFactory has been neutered. Should not crash.
576 factory->Init("TestUserAgent", BindToTrackerCallback()); 576 factory->Init("TestUserAgent", BindToTrackerCallback());
577 577
578 // At this point, attempting to use the factory would trigger a crash. Both 578 // At this point, attempting to use the factory would trigger a crash. Both
579 // this test and the real world code should make sure this never happens. 579 // this test and the real world code should make sure this never happens.
580 } 580 }
581 581
582 } // namespace syncer 582 } // namespace syncer
OLDNEW
« no previous file with comments | « storage/browser/quota/quota_manager_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698