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

Side by Side Diff: content/public/test/browser_test_utils.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 } 774 }
775 775
776 std::string GetCookies(BrowserContext* browser_context, const GURL& url) { 776 std::string GetCookies(BrowserContext* browser_context, const GURL& url) {
777 std::string cookies; 777 std::string cookies;
778 base::WaitableEvent event(true, false); 778 base::WaitableEvent event(true, false);
779 net::URLRequestContextGetter* context_getter = 779 net::URLRequestContextGetter* context_getter =
780 browser_context->GetRequestContext(); 780 browser_context->GetRequestContext();
781 781
782 BrowserThread::PostTask( 782 BrowserThread::PostTask(
783 BrowserThread::IO, FROM_HERE, 783 BrowserThread::IO, FROM_HERE,
784 base::Bind(&GetCookiesOnIOThread, url, 784 base::Bind(&GetCookiesOnIOThread, url, base::RetainedRef(context_getter),
785 make_scoped_refptr(context_getter), &event, &cookies)); 785 &event, &cookies));
786 event.Wait(); 786 event.Wait();
787 return cookies; 787 return cookies;
788 } 788 }
789 789
790 bool SetCookie(BrowserContext* browser_context, 790 bool SetCookie(BrowserContext* browser_context,
791 const GURL& url, 791 const GURL& url,
792 const std::string& value) { 792 const std::string& value) {
793 bool result = false; 793 bool result = false;
794 base::WaitableEvent event(true, false); 794 base::WaitableEvent event(true, false);
795 net::URLRequestContextGetter* context_getter = 795 net::URLRequestContextGetter* context_getter =
796 browser_context->GetRequestContext(); 796 browser_context->GetRequestContext();
797 797
798 BrowserThread::PostTask( 798 BrowserThread::PostTask(
799 BrowserThread::IO, FROM_HERE, 799 BrowserThread::IO, FROM_HERE,
800 base::Bind(&SetCookieOnIOThread, url, value, 800 base::Bind(&SetCookieOnIOThread, url, value,
801 make_scoped_refptr(context_getter), &event, &result)); 801 base::RetainedRef(context_getter), &event, &result));
802 event.Wait(); 802 event.Wait();
803 return result; 803 return result;
804 } 804 }
805 805
806 void FetchHistogramsFromChildProcesses() { 806 void FetchHistogramsFromChildProcesses() {
807 scoped_refptr<content::MessageLoopRunner> runner = new MessageLoopRunner; 807 scoped_refptr<content::MessageLoopRunner> runner = new MessageLoopRunner;
808 808
809 FetchHistogramsAsynchronously( 809 FetchHistogramsAsynchronously(
810 base::MessageLoop::current(), 810 base::MessageLoop::current(),
811 runner->QuitClosure(), 811 runner->QuitClosure(),
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1189 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1190 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) 1190 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN)
1191 return ack_result_; 1191 return ack_result_;
1192 base::RunLoop run_loop; 1192 base::RunLoop run_loop;
1193 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); 1193 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure());
1194 run_loop.Run(); 1194 run_loop.Run();
1195 return ack_result_; 1195 return ack_result_;
1196 } 1196 }
1197 1197
1198 } // namespace content 1198 } // namespace content
OLDNEW
« no previous file with comments | « content/child/service_worker/web_service_worker_impl.cc ('k') | content/renderer/browser_render_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698