OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
8 #import <WebKit/WebKit.h> | 8 #import <WebKit/WebKit.h> |
9 | 9 |
| 10 #include <utility> |
| 11 |
10 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
11 #include "base/ios/ios_util.h" | 13 #include "base/ios/ios_util.h" |
12 #import "base/mac/bind_objc_block.h" | 14 #import "base/mac/bind_objc_block.h" |
13 #include "base/mac/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
14 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
15 #include "base/test/histogram_tester.h" | 17 #include "base/test/histogram_tester.h" |
16 #import "base/test/ios/wait_util.h" | 18 #import "base/test/ios/wait_util.h" |
17 #include "base/values.h" | 19 #include "base/values.h" |
18 #import "ios/testing/ocmock_complex_type_helper.h" | 20 #import "ios/testing/ocmock_complex_type_helper.h" |
19 #include "ios/web/navigation/crw_session_controller.h" | 21 #include "ios/web/navigation/crw_session_controller.h" |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 NSString* mixedCaseCookieHeaderName = @"cOoKiE"; | 1113 NSString* mixedCaseCookieHeaderName = @"cOoKiE"; |
1112 NSString* otherHeaderName = @"Myheader"; | 1114 NSString* otherHeaderName = @"Myheader"; |
1113 NSString* otherHeaderValue = @"A"; | 1115 NSString* otherHeaderValue = @"A"; |
1114 NSString* otherHeaderIncorrectValue = @"C"; | 1116 NSString* otherHeaderIncorrectValue = @"C"; |
1115 | 1117 |
1116 scoped_ptr<web::NavigationItemImpl> item(new web::NavigationItemImpl()); | 1118 scoped_ptr<web::NavigationItemImpl> item(new web::NavigationItemImpl()); |
1117 item->SetURL(url); | 1119 item->SetURL(url); |
1118 item->SetTransitionType(ui::PAGE_TRANSITION_FORM_SUBMIT); | 1120 item->SetTransitionType(ui::PAGE_TRANSITION_FORM_SUBMIT); |
1119 item->set_is_renderer_initiated(true); | 1121 item->set_is_renderer_initiated(true); |
1120 base::scoped_nsobject<CRWSessionEntry> currentEntry( | 1122 base::scoped_nsobject<CRWSessionEntry> currentEntry( |
1121 [[CRWSessionEntry alloc] initWithNavigationItem:item.Pass()]); | 1123 [[CRWSessionEntry alloc] initWithNavigationItem:std::move(item)]); |
1122 base::scoped_nsobject<NSMutableURLRequest> request( | 1124 base::scoped_nsobject<NSMutableURLRequest> request( |
1123 [[NSMutableURLRequest alloc] initWithURL:net::NSURLWithGURL(url)]); | 1125 [[NSMutableURLRequest alloc] initWithURL:net::NSURLWithGURL(url)]); |
1124 [request setHTTPMethod:@"POST"]; | 1126 [request setHTTPMethod:@"POST"]; |
1125 [request setValue:otherHeaderValue forHTTPHeaderField:otherHeaderName]; | 1127 [request setValue:otherHeaderValue forHTTPHeaderField:otherHeaderName]; |
1126 [request setValue:@"B" forHTTPHeaderField:mixedCaseCookieHeaderName]; | 1128 [request setValue:@"B" forHTTPHeaderField:mixedCaseCookieHeaderName]; |
1127 // No data is cached initially. | 1129 // No data is cached initially. |
1128 EXPECT_EQ(nil, [currentEntry navigationItemImpl]->GetPostData()); | 1130 EXPECT_EQ(nil, [currentEntry navigationItemImpl]->GetPostData()); |
1129 EXPECT_EQ(nil, [currentEntry navigationItem]->GetHttpRequestHeaders()); | 1131 EXPECT_EQ(nil, [currentEntry navigationItem]->GetHttpRequestHeaders()); |
1130 // Streams are not cached. | 1132 // Streams are not cached. |
1131 [request setHTTPBodyStream:[NSInputStream inputStreamWithData:[NSData data]]]; | 1133 [request setHTTPBodyStream:[NSInputStream inputStreamWithData:[NSData data]]]; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 // https://bugs.webkit.org/show_bug.cgi?id=140203 | 1560 // https://bugs.webkit.org/show_bug.cgi?id=140203 |
1559 VLOG(1) << "Script has been flushed."; | 1561 VLOG(1) << "Script has been flushed."; |
1560 }]; | 1562 }]; |
1561 // -evaluateJavaScript:stringResultHandler: is asynchronous so JavaScript | 1563 // -evaluateJavaScript:stringResultHandler: is asynchronous so JavaScript |
1562 // evaluation will not happen until TearDown, which deallocates | 1564 // evaluation will not happen until TearDown, which deallocates |
1563 // CRWWebController, which in its turn will deallocate WKWebView to create a | 1565 // CRWWebController, which in its turn will deallocate WKWebView to create a |
1564 // crashy condition. | 1566 // crashy condition. |
1565 }; | 1567 }; |
1566 | 1568 |
1567 } // namespace | 1569 } // namespace |
OLD | NEW |