| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 #include "content/common/text_input_state.h" | 34 #include "content/common/text_input_state.h" |
| 35 #include "content/common/view_messages.h" | 35 #include "content/common/view_messages.h" |
| 36 #include "content/public/browser/browser_context.h" | 36 #include "content/public/browser/browser_context.h" |
| 37 #include "content/public/browser/histogram_fetcher.h" | 37 #include "content/public/browser/histogram_fetcher.h" |
| 38 #include "content/public/browser/navigation_entry.h" | 38 #include "content/public/browser/navigation_entry.h" |
| 39 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
| 40 #include "content/public/browser/notification_types.h" | 40 #include "content/public/browser/notification_types.h" |
| 41 #include "content/public/browser/render_frame_host.h" | 41 #include "content/public/browser/render_frame_host.h" |
| 42 #include "content/public/browser/render_process_host.h" | 42 #include "content/public/browser/render_process_host.h" |
| 43 #include "content/public/browser/render_view_host.h" | 43 #include "content/public/browser/render_view_host.h" |
| 44 #include "content/public/browser/storage_partition.h" |
| 44 #include "content/public/browser/web_contents.h" | 45 #include "content/public/browser/web_contents.h" |
| 45 #include "content/public/test/test_navigation_observer.h" | 46 #include "content/public/test/test_navigation_observer.h" |
| 46 #include "content/public/test/test_utils.h" | 47 #include "content/public/test/test_utils.h" |
| 47 #include "net/base/filename_util.h" | 48 #include "net/base/filename_util.h" |
| 48 #include "net/cookies/cookie_store.h" | 49 #include "net/cookies/cookie_store.h" |
| 49 #include "net/test/embedded_test_server/embedded_test_server.h" | 50 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 50 #include "net/test/embedded_test_server/http_request.h" | 51 #include "net/test/embedded_test_server/http_request.h" |
| 51 #include "net/test/embedded_test_server/http_response.h" | 52 #include "net/test/embedded_test_server/http_response.h" |
| 52 #include "net/test/python_utils.h" | 53 #include "net/test/python_utils.h" |
| 53 #include "net/url_request/url_request_context.h" | 54 #include "net/url_request/url_request_context.h" |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 return false; | 784 return false; |
| 784 } while (message.compare("\"PENDING\"") == 0); | 785 } while (message.compare("\"PENDING\"") == 0); |
| 785 | 786 |
| 786 return message.compare("\"SUCCESS\"") == 0; | 787 return message.compare("\"SUCCESS\"") == 0; |
| 787 } | 788 } |
| 788 | 789 |
| 789 std::string GetCookies(BrowserContext* browser_context, const GURL& url) { | 790 std::string GetCookies(BrowserContext* browser_context, const GURL& url) { |
| 790 std::string cookies; | 791 std::string cookies; |
| 791 base::WaitableEvent event(true, false); | 792 base::WaitableEvent event(true, false); |
| 792 net::URLRequestContextGetter* context_getter = | 793 net::URLRequestContextGetter* context_getter = |
| 793 browser_context->GetRequestContext(); | 794 BrowserContext::GetDefaultStoragePartition(browser_context)-> |
| 795 GetURLRequestContext(); |
| 794 | 796 |
| 795 BrowserThread::PostTask( | 797 BrowserThread::PostTask( |
| 796 BrowserThread::IO, FROM_HERE, | 798 BrowserThread::IO, FROM_HERE, |
| 797 base::Bind(&GetCookiesOnIOThread, url, base::RetainedRef(context_getter), | 799 base::Bind(&GetCookiesOnIOThread, url, base::RetainedRef(context_getter), |
| 798 &event, &cookies)); | 800 &event, &cookies)); |
| 799 event.Wait(); | 801 event.Wait(); |
| 800 return cookies; | 802 return cookies; |
| 801 } | 803 } |
| 802 | 804 |
| 803 bool SetCookie(BrowserContext* browser_context, | 805 bool SetCookie(BrowserContext* browser_context, |
| 804 const GURL& url, | 806 const GURL& url, |
| 805 const std::string& value) { | 807 const std::string& value) { |
| 806 bool result = false; | 808 bool result = false; |
| 807 base::WaitableEvent event(true, false); | 809 base::WaitableEvent event(true, false); |
| 808 net::URLRequestContextGetter* context_getter = | 810 net::URLRequestContextGetter* context_getter = |
| 809 browser_context->GetRequestContext(); | 811 BrowserContext::GetDefaultStoragePartition(browser_context)-> |
| 812 GetURLRequestContext(); |
| 810 | 813 |
| 811 BrowserThread::PostTask( | 814 BrowserThread::PostTask( |
| 812 BrowserThread::IO, FROM_HERE, | 815 BrowserThread::IO, FROM_HERE, |
| 813 base::Bind(&SetCookieOnIOThread, url, value, | 816 base::Bind(&SetCookieOnIOThread, url, value, |
| 814 base::RetainedRef(context_getter), &event, &result)); | 817 base::RetainedRef(context_getter), &event, &result)); |
| 815 event.Wait(); | 818 event.Wait(); |
| 816 return result; | 819 return result; |
| 817 } | 820 } |
| 818 | 821 |
| 819 void FetchHistogramsFromChildProcesses() { | 822 void FetchHistogramsFromChildProcesses() { |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 // static | 1244 // static |
| 1242 TextInputStateTestExport TextInputStateTestExport::FromWebContents( | 1245 TextInputStateTestExport TextInputStateTestExport::FromWebContents( |
| 1243 WebContents* web_contents) { | 1246 WebContents* web_contents) { |
| 1244 const TextInputState* state = | 1247 const TextInputState* state = |
| 1245 static_cast<WebContentsImpl*>(web_contents)->GetTextInputState(); | 1248 static_cast<WebContentsImpl*>(web_contents)->GetTextInputState(); |
| 1246 | 1249 |
| 1247 return TextInputStateTestExport(state->type, state->value); | 1250 return TextInputStateTestExport(state->type, state->value); |
| 1248 } | 1251 } |
| 1249 | 1252 |
| 1250 } // namespace content | 1253 } // namespace content |
| OLD | NEW |