| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <math.h> | 5 #include <math.h> |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 frame_state->target = NS16("foo"); | 98 frame_state->target = NS16("foo"); |
| 99 frame_state->state_object = NS16(NULL); | 99 frame_state->state_object = NS16(NULL); |
| 100 frame_state->document_state.push_back(NS16("1")); | 100 frame_state->document_state.push_back(NS16("1")); |
| 101 frame_state->document_state.push_back(NS16("q")); | 101 frame_state->document_state.push_back(NS16("q")); |
| 102 frame_state->document_state.push_back(NS16("text")); | 102 frame_state->document_state.push_back(NS16("text")); |
| 103 frame_state->document_state.push_back(NS16("dev.chromium.org")); | 103 frame_state->document_state.push_back(NS16("dev.chromium.org")); |
| 104 frame_state->pinch_viewport_scroll_offset = gfx::PointF(10, 15); | 104 frame_state->pinch_viewport_scroll_offset = gfx::PointF(10, 15); |
| 105 frame_state->scroll_offset = gfx::Point(0, 100); | 105 frame_state->scroll_offset = gfx::Point(0, 100); |
| 106 frame_state->item_sequence_number = 1; | 106 frame_state->item_sequence_number = 1; |
| 107 frame_state->document_sequence_number = 2; | 107 frame_state->document_sequence_number = 2; |
| 108 frame_state->frame_sequence_number = 3; |
| 108 frame_state->page_scale_factor = 2.0; | 109 frame_state->page_scale_factor = 2.0; |
| 109 } | 110 } |
| 110 | 111 |
| 111 void PopulateHttpBody(ExplodedHttpBody* http_body, | 112 void PopulateHttpBody(ExplodedHttpBody* http_body, |
| 112 std::vector<base::NullableString16>* referenced_files) { | 113 std::vector<base::NullableString16>* referenced_files) { |
| 113 http_body->is_null = false; | 114 http_body->is_null = false; |
| 114 http_body->identifier = 12345; | 115 http_body->identifier = 12345; |
| 115 http_body->contains_passwords = false; | 116 http_body->contains_passwords = false; |
| 116 http_body->http_content_type = NS16("text/foo"); | 117 http_body->http_content_type = NS16("text/foo"); |
| 117 | 118 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 136 bool is_child) { | 137 bool is_child) { |
| 137 frame_state->url_string = NS16("http://chromium.org/"); | 138 frame_state->url_string = NS16("http://chromium.org/"); |
| 138 frame_state->referrer = NS16("http://google.com/"); | 139 frame_state->referrer = NS16("http://google.com/"); |
| 139 frame_state->referrer_policy = blink::WebReferrerPolicyDefault; | 140 frame_state->referrer_policy = blink::WebReferrerPolicyDefault; |
| 140 if (!is_child) | 141 if (!is_child) |
| 141 frame_state->target = NS16("target"); | 142 frame_state->target = NS16("target"); |
| 142 frame_state->pinch_viewport_scroll_offset = gfx::PointF(-1, -1); | 143 frame_state->pinch_viewport_scroll_offset = gfx::PointF(-1, -1); |
| 143 frame_state->scroll_offset = gfx::Point(42, -42); | 144 frame_state->scroll_offset = gfx::Point(42, -42); |
| 144 frame_state->item_sequence_number = 123; | 145 frame_state->item_sequence_number = 123; |
| 145 frame_state->document_sequence_number = 456; | 146 frame_state->document_sequence_number = 456; |
| 147 frame_state->frame_sequence_number = 789; |
| 146 frame_state->page_scale_factor = 2.0f; | 148 frame_state->page_scale_factor = 2.0f; |
| 147 | 149 |
| 148 frame_state->document_state.push_back( | 150 frame_state->document_state.push_back( |
| 149 NS16("\n\r?% WebKit serialized form state version 8 \n\r=&")); | 151 NS16("\n\r?% WebKit serialized form state version 8 \n\r=&")); |
| 150 frame_state->document_state.push_back(NS16("form key")); | 152 frame_state->document_state.push_back(NS16("form key")); |
| 151 frame_state->document_state.push_back(NS16("1")); | 153 frame_state->document_state.push_back(NS16("1")); |
| 152 frame_state->document_state.push_back(NS16("foo")); | 154 frame_state->document_state.push_back(NS16("foo")); |
| 153 frame_state->document_state.push_back(NS16("file")); | 155 frame_state->document_state.push_back(NS16("file")); |
| 154 frame_state->document_state.push_back(NS16("2")); | 156 frame_state->document_state.push_back(NS16("2")); |
| 155 frame_state->document_state.push_back(NS16("file.txt")); | 157 frame_state->document_state.push_back(NS16("file.txt")); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } | 419 } |
| 418 | 420 |
| 419 TEST_F(PageStateSerializationTest, BackwardsCompat_v16) { | 421 TEST_F(PageStateSerializationTest, BackwardsCompat_v16) { |
| 420 TestBackwardsCompat(16); | 422 TestBackwardsCompat(16); |
| 421 } | 423 } |
| 422 | 424 |
| 423 TEST_F(PageStateSerializationTest, BackwardsCompat_v18) { | 425 TEST_F(PageStateSerializationTest, BackwardsCompat_v18) { |
| 424 TestBackwardsCompat(18); | 426 TestBackwardsCompat(18); |
| 425 } | 427 } |
| 426 | 428 |
| 429 TEST_F(PageStateSerializationTest, BackwardsCompat_v20) { |
| 430 TestBackwardsCompat(20); |
| 431 } |
| 432 |
| 427 } // namespace | 433 } // namespace |
| 428 } // namespace content | 434 } // namespace content |
| OLD | NEW |