Chromium Code Reviews| Index: content/test/test_render_frame_host.cc |
| diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc |
| index 21557a28efce43d517d0f4214e40599ed79478b4..f39816ef5808f1d03f445fbf7a05f5d725b4dcdf 100644 |
| --- a/content/test/test_render_frame_host.cc |
| +++ b/content/test/test_render_frame_host.cc |
| @@ -5,6 +5,8 @@ |
| #include "content/test/test_render_frame_host.h" |
| #include "base/guid.h" |
| +#include "base/strings/nullable_string16.h" |
| +#include "base/strings/utf_string_conversions.h" |
| #include "content/browser/frame_host/frame_tree.h" |
| #include "content/browser/frame_host/navigation_handle_impl.h" |
| #include "content/browser/frame_host/navigation_request.h" |
| @@ -14,6 +16,7 @@ |
| #include "content/browser/web_contents/web_contents_impl.h" |
| #include "content/common/frame_messages.h" |
| #include "content/common/frame_owner_properties.h" |
| +#include "content/common/page_state_serialization.h" |
| #include "content/public/browser/navigation_throttle.h" |
| #include "content/public/browser/stream_handle.h" |
| #include "content/public/common/browser_side_navigation_policy.h" |
| @@ -350,9 +353,8 @@ void TestRenderFrameHost::SendNavigateWithParameters( |
| url_copy.ReplaceComponents(replacements) == |
| GetLastCommittedURL().ReplaceComponents(replacements); |
| - params.page_state = |
| - PageState::CreateForTesting(url_copy, false, nullptr, nullptr); |
| - |
| + params.page_state = TestRenderFrameHost::CreatePageStateForURL( |
| + url_copy, params.item_sequence_number, params.document_sequence_number); |
| if (!callback.is_null()) |
| callback.Run(¶ms); |
| @@ -465,6 +467,23 @@ TestRenderFrameHost::CreateWebBluetoothServiceForTesting() { |
| return service; |
| } |
| +// static |
| +PageState TestRenderFrameHost::CreatePageStateForURL( |
| + const GURL& url, |
| + int64_t item_sequence_number, |
| + int64_t document_sequence_number) { |
| + content::ExplodedPageState page_state; |
| + page_state.top.url_string = |
| + base::NullableString16(base::UTF8ToUTF16(url.spec()), false); |
| + page_state.top.item_sequence_number = item_sequence_number; |
| + page_state.top.document_sequence_number = document_sequence_number; |
| + |
| + std::string encoded_page_state; |
| + EncodePageState(page_state, &encoded_page_state); |
| + return PageState::CreateFromEncodedData(encoded_page_state); |
|
nasko
2016/09/07 23:21:59
This code looks fine, but why can't this remain a
ananta
2016/09/07 23:58:44
Added a new method CreateForTestingWithSequenceNum
|
| +} |
| + |
| + |
| int32_t TestRenderFrameHost::ComputeNextPageID() { |
| const NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( |
| frame_tree_node()->navigator()->GetController()->GetPendingEntry()); |