| 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 "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/common/dom_storage/dom_storage_types.h" | 8 #include "content/common/dom_storage/dom_storage_types.h" |
| 9 #include "content/common/frame_messages.h" | 9 #include "content/common/frame_messages.h" |
| 10 #include "content/common/input_messages.h" | 10 #include "content/common/input_messages.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void RenderViewTest::LoadHTML(const char* html) { | 117 void RenderViewTest::LoadHTML(const char* html) { |
| 118 std::string url_str = "data:text/html;charset=utf-8,"; | 118 std::string url_str = "data:text/html;charset=utf-8,"; |
| 119 url_str.append(html); | 119 url_str.append(html); |
| 120 GURL url(url_str); | 120 GURL url(url_str); |
| 121 GetMainFrame()->loadRequest(WebURLRequest(url)); | 121 GetMainFrame()->loadRequest(WebURLRequest(url)); |
| 122 // The load actually happens asynchronously, so we pump messages to process | 122 // The load actually happens asynchronously, so we pump messages to process |
| 123 // the pending continuation. | 123 // the pending continuation. |
| 124 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 124 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 PageState RenderViewTest::GetCurrentPageState() { |
| 128 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 129 return HistoryEntryToPageState(impl->history_controller()->GetCurrentEntry()); |
| 130 } |
| 131 |
| 127 void RenderViewTest::GoBack(const PageState& state) { | 132 void RenderViewTest::GoBack(const PageState& state) { |
| 128 GoToOffset(-1, state); | 133 GoToOffset(-1, state); |
| 129 } | 134 } |
| 130 | 135 |
| 131 void RenderViewTest::GoForward(const PageState& state) { | 136 void RenderViewTest::GoForward(const PageState& state) { |
| 132 GoToOffset(1, state); | 137 GoToOffset(1, state); |
| 133 } | 138 } |
| 134 | 139 |
| 135 void RenderViewTest::GoBackToPrevious() { | |
| 136 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | |
| 137 GoBack(HistoryEntryToPageState( | |
| 138 impl->history_controller()->GetPreviousEntry())); | |
| 139 } | |
| 140 | |
| 141 void RenderViewTest::SetUp() { | 140 void RenderViewTest::SetUp() { |
| 142 content_client_.reset(CreateContentClient()); | 141 content_client_.reset(CreateContentClient()); |
| 143 content_browser_client_.reset(CreateContentBrowserClient()); | 142 content_browser_client_.reset(CreateContentBrowserClient()); |
| 144 content_renderer_client_.reset(CreateContentRendererClient()); | 143 content_renderer_client_.reset(CreateContentRendererClient()); |
| 145 SetContentClient(content_client_.get()); | 144 SetContentClient(content_client_.get()); |
| 146 SetBrowserClientForTesting(content_browser_client_.get()); | 145 SetBrowserClientForTesting(content_browser_client_.get()); |
| 147 SetRendererClientForTesting(content_renderer_client_.get()); | 146 SetRendererClientForTesting(content_renderer_client_.get()); |
| 148 | 147 |
| 149 // Subclasses can set render_thread_ with their own implementation before | 148 // Subclasses can set render_thread_ with their own implementation before |
| 150 // calling RenderViewTest::SetUp(). | 149 // calling RenderViewTest::SetUp(). |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 FrameMsg_Navigate navigate_message(impl->main_render_frame()->GetRoutingID(), | 421 FrameMsg_Navigate navigate_message(impl->main_render_frame()->GetRoutingID(), |
| 423 navigate_params); | 422 navigate_params); |
| 424 impl->main_render_frame()->OnMessageReceived(navigate_message); | 423 impl->main_render_frame()->OnMessageReceived(navigate_message); |
| 425 | 424 |
| 426 // The load actually happens asynchronously, so we pump messages to process | 425 // The load actually happens asynchronously, so we pump messages to process |
| 427 // the pending continuation. | 426 // the pending continuation. |
| 428 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 427 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
| 429 } | 428 } |
| 430 | 429 |
| 431 } // namespace content | 430 } // namespace content |
| OLD | NEW |