Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: content/public/common/page_state.cc

Issue 2309583002: Fix for the NavigationControllerTest.BackSubframe test failures with PlzNavigate (Closed)
Patch Set: Set document_sequence_number correctly and use the same strategy like Blink to generate these numbe… Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/common/page_state.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/common/page_state.h" 5 #include "content/public/common/page_state.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/nullable_string16.h" 10 #include "base/strings/nullable_string16.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 state.referenced_files.push_back(base::NullableString16( 98 state.referenced_files.push_back(base::NullableString16(
99 optional_body_file_path->AsUTF16Unsafe(), false)); 99 optional_body_file_path->AsUTF16Unsafe(), false));
100 } 100 }
101 state.top.http_body.contains_passwords = 101 state.top.http_body.contains_passwords =
102 body_contains_password_data; 102 body_contains_password_data;
103 } 103 }
104 104
105 return ToPageState(state); 105 return ToPageState(state);
106 } 106 }
107 107
108 // static
109 PageState PageState::CreateForTestingWithSequenceNumbers(
110 const GURL& url,
111 int64_t item_sequence_number,
112 int64_t document_sequence_number) {
113 ExplodedPageState page_state;
114 page_state.top.url_string = ToNullableString16(url.spec());
115 page_state.top.item_sequence_number = item_sequence_number;
116 page_state.top.document_sequence_number = document_sequence_number;
117
118 std::string encoded_page_state;
119 EncodePageState(page_state, &encoded_page_state);
120 return CreateFromEncodedData(encoded_page_state);
121 }
122
108 PageState::PageState() { 123 PageState::PageState() {
109 } 124 }
110 125
111 bool PageState::IsValid() const { 126 bool PageState::IsValid() const {
112 return !data_.empty(); 127 return !data_.empty();
113 } 128 }
114 129
115 bool PageState::Equals(const PageState& other) const { 130 bool PageState::Equals(const PageState& other) const {
116 return data_ == other.data_; 131 return data_ == other.data_;
117 } 132 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 179 }
165 180
166 PageState::PageState(const std::string& data) 181 PageState::PageState(const std::string& data)
167 : data_(data) { 182 : data_(data) {
168 // TODO(darin): Enable this DCHECK once tests have been fixed up to not pass 183 // TODO(darin): Enable this DCHECK once tests have been fixed up to not pass
169 // bogus encoded data to CreateFromEncodedData. 184 // bogus encoded data to CreateFromEncodedData.
170 //DCHECK(IsValid()); 185 //DCHECK(IsValid());
171 } 186 }
172 187
173 } // namespace content 188 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/page_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698