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/render_view_test.h" | 5 #include "content/public/test/render_view_test.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "components/scheduler/renderer/renderer_scheduler.h" | 12 #include "components/scheduler/renderer/renderer_scheduler.h" |
13 #include "content/app/mojo/mojo_init.h" | 13 #include "content/app/mojo/mojo_init.h" |
14 #include "content/common/dom_storage/dom_storage_types.h" | 14 #include "content/common/dom_storage/dom_storage_types.h" |
15 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
16 #include "content/common/input_messages.h" | 16 #include "content/common/input_messages.h" |
| 17 #include "content/common/site_isolation_policy.h" |
17 #include "content/common/view_messages.h" | 18 #include "content/common/view_messages.h" |
18 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
19 #include "content/public/browser/native_web_keyboard_event.h" | 20 #include "content/public/browser/native_web_keyboard_event.h" |
20 #include "content/public/common/content_client.h" | 21 #include "content/public/common/content_client.h" |
21 #include "content/public/common/renderer_preferences.h" | 22 #include "content/public/common/renderer_preferences.h" |
22 #include "content/public/renderer/content_renderer_client.h" | 23 #include "content/public/renderer/content_renderer_client.h" |
23 #include "content/public/test/frame_load_waiter.h" | 24 #include "content/public/test/frame_load_waiter.h" |
24 #include "content/renderer/history_controller.h" | 25 #include "content/renderer/history_controller.h" |
25 #include "content/renderer/history_serialization.h" | 26 #include "content/renderer/history_serialization.h" |
26 #include "content/renderer/render_thread_impl.h" | 27 #include "content/renderer/render_thread_impl.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 GURL url(url_str); | 174 GURL url(url_str); |
174 WebURLRequest request(url); | 175 WebURLRequest request(url); |
175 request.setCheckForBrowserSideNavigation(false); | 176 request.setCheckForBrowserSideNavigation(false); |
176 GetMainFrame()->loadRequest(request); | 177 GetMainFrame()->loadRequest(request); |
177 // The load actually happens asynchronously, so we pump messages to process | 178 // The load actually happens asynchronously, so we pump messages to process |
178 // the pending continuation. | 179 // the pending continuation. |
179 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 180 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
180 } | 181 } |
181 | 182 |
182 PageState RenderViewTest::GetCurrentPageState() { | 183 PageState RenderViewTest::GetCurrentPageState() { |
183 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 184 RenderViewImpl* view_impl = static_cast<RenderViewImpl*>(view_); |
184 return HistoryEntryToPageState(impl->history_controller()->GetCurrentEntry()); | 185 |
| 186 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 187 // This returns a PageState object for the main frame, excluding subframes. |
| 188 // This could be extended to all local frames if needed by tests, but it |
| 189 // cannot include out-of-process frames. |
| 190 TestRenderFrame* frame = |
| 191 static_cast<TestRenderFrame*>(view_impl->GetMainRenderFrame()); |
| 192 return SingleHistoryItemToPageState(frame->current_history_item()); |
| 193 } else { |
| 194 return HistoryEntryToPageState( |
| 195 view_impl->history_controller()->GetCurrentEntry()); |
| 196 } |
185 } | 197 } |
186 | 198 |
187 void RenderViewTest::GoBack(const PageState& state) { | 199 void RenderViewTest::GoBack(const PageState& state) { |
188 GoToOffset(-1, state); | 200 GoToOffset(-1, state); |
189 } | 201 } |
190 | 202 |
191 void RenderViewTest::GoForward(const PageState& state) { | 203 void RenderViewTest::GoForward(const PageState& state) { |
192 GoToOffset(1, state); | 204 GoToOffset(1, state); |
193 } | 205 } |
194 | 206 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 TestRenderFrame* frame = | 612 TestRenderFrame* frame = |
601 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 613 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
602 frame->Navigate(common_params, StartNavigationParams(), request_params); | 614 frame->Navigate(common_params, StartNavigationParams(), request_params); |
603 | 615 |
604 // The load actually happens asynchronously, so we pump messages to process | 616 // The load actually happens asynchronously, so we pump messages to process |
605 // the pending continuation. | 617 // the pending continuation. |
606 FrameLoadWaiter(frame).Wait(); | 618 FrameLoadWaiter(frame).Wait(); |
607 } | 619 } |
608 | 620 |
609 } // namespace content | 621 } // namespace content |
OLD | NEW |