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

Side by Side Diff: content/public/test/browser_test_utils.cc

Issue 1878153002: Revert of Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « content/public/browser/browser_context.h ('k') | content/public/test/test_browser_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 21 matching lines...) Expand all
32 #include "content/common/text_input_state.h" 32 #include "content/common/text_input_state.h"
33 #include "content/common/view_messages.h" 33 #include "content/common/view_messages.h"
34 #include "content/public/browser/browser_context.h" 34 #include "content/public/browser/browser_context.h"
35 #include "content/public/browser/histogram_fetcher.h" 35 #include "content/public/browser/histogram_fetcher.h"
36 #include "content/public/browser/navigation_entry.h" 36 #include "content/public/browser/navigation_entry.h"
37 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/notification_types.h" 38 #include "content/public/browser/notification_types.h"
39 #include "content/public/browser/render_frame_host.h" 39 #include "content/public/browser/render_frame_host.h"
40 #include "content/public/browser/render_process_host.h" 40 #include "content/public/browser/render_process_host.h"
41 #include "content/public/browser/render_view_host.h" 41 #include "content/public/browser/render_view_host.h"
42 #include "content/public/browser/storage_partition.h"
43 #include "content/public/browser/web_contents.h" 42 #include "content/public/browser/web_contents.h"
44 #include "content/public/test/test_navigation_observer.h" 43 #include "content/public/test/test_navigation_observer.h"
45 #include "content/public/test/test_utils.h" 44 #include "content/public/test/test_utils.h"
46 #include "net/base/filename_util.h" 45 #include "net/base/filename_util.h"
47 #include "net/cookies/cookie_store.h" 46 #include "net/cookies/cookie_store.h"
48 #include "net/test/embedded_test_server/embedded_test_server.h" 47 #include "net/test/embedded_test_server/embedded_test_server.h"
49 #include "net/test/embedded_test_server/http_request.h" 48 #include "net/test/embedded_test_server/http_request.h"
50 #include "net/test/embedded_test_server/http_response.h" 49 #include "net/test/embedded_test_server/http_response.h"
51 #include "net/test/python_utils.h" 50 #include "net/test/python_utils.h"
52 #include "net/url_request/url_request_context.h" 51 #include "net/url_request/url_request_context.h"
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 return false; 774 return false;
776 } while (message.compare("\"PENDING\"") == 0); 775 } while (message.compare("\"PENDING\"") == 0);
777 776
778 return message.compare("\"SUCCESS\"") == 0; 777 return message.compare("\"SUCCESS\"") == 0;
779 } 778 }
780 779
781 std::string GetCookies(BrowserContext* browser_context, const GURL& url) { 780 std::string GetCookies(BrowserContext* browser_context, const GURL& url) {
782 std::string cookies; 781 std::string cookies;
783 base::WaitableEvent event(true, false); 782 base::WaitableEvent event(true, false);
784 net::URLRequestContextGetter* context_getter = 783 net::URLRequestContextGetter* context_getter =
785 BrowserContext::GetDefaultStoragePartition(browser_context)-> 784 browser_context->GetRequestContext();
786 GetURLRequestContext();
787 785
788 BrowserThread::PostTask( 786 BrowserThread::PostTask(
789 BrowserThread::IO, FROM_HERE, 787 BrowserThread::IO, FROM_HERE,
790 base::Bind(&GetCookiesOnIOThread, url, base::RetainedRef(context_getter), 788 base::Bind(&GetCookiesOnIOThread, url, base::RetainedRef(context_getter),
791 &event, &cookies)); 789 &event, &cookies));
792 event.Wait(); 790 event.Wait();
793 return cookies; 791 return cookies;
794 } 792 }
795 793
796 bool SetCookie(BrowserContext* browser_context, 794 bool SetCookie(BrowserContext* browser_context,
797 const GURL& url, 795 const GURL& url,
798 const std::string& value) { 796 const std::string& value) {
799 bool result = false; 797 bool result = false;
800 base::WaitableEvent event(true, false); 798 base::WaitableEvent event(true, false);
801 net::URLRequestContextGetter* context_getter = 799 net::URLRequestContextGetter* context_getter =
802 BrowserContext::GetDefaultStoragePartition(browser_context)-> 800 browser_context->GetRequestContext();
803 GetURLRequestContext();
804 801
805 BrowserThread::PostTask( 802 BrowserThread::PostTask(
806 BrowserThread::IO, FROM_HERE, 803 BrowserThread::IO, FROM_HERE,
807 base::Bind(&SetCookieOnIOThread, url, value, 804 base::Bind(&SetCookieOnIOThread, url, value,
808 base::RetainedRef(context_getter), &event, &result)); 805 base::RetainedRef(context_getter), &event, &result));
809 event.Wait(); 806 event.Wait();
810 return result; 807 return result;
811 } 808 }
812 809
813 void FetchHistogramsFromChildProcesses() { 810 void FetchHistogramsFromChildProcesses() {
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 // static 1232 // static
1236 TextInputStateTestExport TextInputStateTestExport::FromWebContents( 1233 TextInputStateTestExport TextInputStateTestExport::FromWebContents(
1237 WebContents* web_contents) { 1234 WebContents* web_contents) {
1238 const TextInputState* state = 1235 const TextInputState* state =
1239 static_cast<WebContentsImpl*>(web_contents)->GetTextInputState(); 1236 static_cast<WebContentsImpl*>(web_contents)->GetTextInputState();
1240 1237
1241 return TextInputStateTestExport(state->type, state->value); 1238 return TextInputStateTestExport(state->type, state->value);
1242 } 1239 }
1243 1240
1244 } // namespace content 1241 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/browser_context.h ('k') | content/public/test/test_browser_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698