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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "content/public/browser/dom_operation_notification_details.h" | 25 #include "content/public/browser/dom_operation_notification_details.h" |
26 #include "content/public/browser/histogram_fetcher.h" | 26 #include "content/public/browser/histogram_fetcher.h" |
27 #include "content/public/browser/navigation_entry.h" | 27 #include "content/public/browser/navigation_entry.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
30 #include "content/public/browser/render_frame_host.h" | 30 #include "content/public/browser/render_frame_host.h" |
31 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
32 #include "content/public/browser/render_view_host.h" | 32 #include "content/public/browser/render_view_host.h" |
33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
34 #include "content/public/browser/web_contents_observer.h" | 34 #include "content/public/browser/web_contents_observer.h" |
35 #include "content/public/common/content_switches.h" | |
35 #include "content/public/test/test_utils.h" | 36 #include "content/public/test/test_utils.h" |
36 #include "net/base/filename_util.h" | 37 #include "net/base/filename_util.h" |
37 #include "net/cookies/cookie_store.h" | 38 #include "net/cookies/cookie_store.h" |
38 #include "net/test/embedded_test_server/embedded_test_server.h" | 39 #include "net/test/embedded_test_server/embedded_test_server.h" |
39 #include "net/test/embedded_test_server/http_request.h" | 40 #include "net/test/embedded_test_server/http_request.h" |
40 #include "net/test/embedded_test_server/http_response.h" | 41 #include "net/test/embedded_test_server/http_response.h" |
41 #include "net/test/python_utils.h" | 42 #include "net/test/python_utils.h" |
42 #include "net/url_request/url_request_context.h" | 43 #include "net/url_request/url_request_context.h" |
43 #include "net/url_request/url_request_context_getter.h" | 44 #include "net/url_request/url_request_context_getter.h" |
44 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
735 new content::MessageLoopRunner); | 736 new content::MessageLoopRunner); |
736 InterstitialObserver observer(web_contents, | 737 InterstitialObserver observer(web_contents, |
737 base::Closure(), | 738 base::Closure(), |
738 loop_runner->QuitClosure()); | 739 loop_runner->QuitClosure()); |
739 if (!task.is_null()) | 740 if (!task.is_null()) |
740 task.Run(); | 741 task.Run(); |
741 // At this point, web_contents may have been deleted. | 742 // At this point, web_contents may have been deleted. |
742 loop_runner->Run(); | 743 loop_runner->Run(); |
743 } | 744 } |
744 | 745 |
746 void IsolateAllSitesForTesting(base::CommandLine* command_line) { | |
747 command_line->AppendSwitch(switches::kSitePerProcess); | |
748 } | |
749 | |
750 bool AreAllSitesIsolatedForTesting() { | |
Charlie Reis
2015/07/21 16:58:24
nit: Move above IsolateAllSitesForTesting so they'
ncarter (slow)
2015/07/22 23:29:08
Done.
| |
751 return base::CommandLine::ForCurrentProcess()->HasSwitch( | |
752 switches::kSitePerProcess); | |
753 } | |
754 | |
745 bool WaitForRenderFrameReady(RenderFrameHost* rfh) { | 755 bool WaitForRenderFrameReady(RenderFrameHost* rfh) { |
746 if (!rfh) | 756 if (!rfh) |
747 return false; | 757 return false; |
748 std::string result; | 758 std::string result; |
749 EXPECT_TRUE( | 759 EXPECT_TRUE( |
750 content::ExecuteScriptAndExtractString( | 760 content::ExecuteScriptAndExtractString( |
751 rfh, | 761 rfh, |
752 "(function() {" | 762 "(function() {" |
753 " var done = false;" | 763 " var done = false;" |
754 " function checkState() {" | 764 " function checkState() {" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1039 void RenderFrameDeletedObserver::WaitUntilDeleted() { | 1049 void RenderFrameDeletedObserver::WaitUntilDeleted() { |
1040 if (deleted_) | 1050 if (deleted_) |
1041 return; | 1051 return; |
1042 | 1052 |
1043 runner_.reset(new base::RunLoop()); | 1053 runner_.reset(new base::RunLoop()); |
1044 runner_->Run(); | 1054 runner_->Run(); |
1045 runner_.reset(); | 1055 runner_.reset(); |
1046 } | 1056 } |
1047 | 1057 |
1048 } // namespace content | 1058 } // namespace content |
OLD | NEW |