| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/js/crw_js_post_request_loader.h" | 5 #import "ios/web/web_state/js/crw_js_post_request_loader.h" |
| 6 | 6 |
| 7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
| 8 | 8 |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 " base64data = reader.result;" | 31 " base64data = reader.result;" |
| 32 " window.webkit.messageHandlers.XHRSendHandler.postMessage(base64data);" | 32 " window.webkit.messageHandlers.XHRSendHandler.postMessage(base64data);" |
| 33 " };" | 33 " };" |
| 34 "};"; | 34 "};"; |
| 35 | 35 |
| 36 // Tests that the POST request is correctly executed through XMLHttpRequest. | 36 // Tests that the POST request is correctly executed through XMLHttpRequest. |
| 37 // TODO(crbug.com/592034): This test is flaky on device. | 37 // TODO(crbug.com/592034): This test is flaky on device. |
| 38 #if TARGET_IPHONE_SIMULATOR | 38 #if TARGET_IPHONE_SIMULATOR |
| 39 #define MAYBE_LoadsCorrectHTML LoadsCorrectHTML | 39 #define MAYBE_LoadsCorrectHTML LoadsCorrectHTML |
| 40 #else | 40 #else |
| 41 #define MAYBE_LoadsCorrectHTML FLAKY_LoadsCorrectHTML | 41 #define MAYBE_LoadsCorrectHTML DISABLED_LoadsCorrectHTML |
| 42 #endif | 42 #endif |
| 43 TEST_F(CRWJSPOSTRequestLoaderTest, MAYBE_LoadsCorrectHTML) { | 43 TEST_F(CRWJSPOSTRequestLoaderTest, MAYBE_LoadsCorrectHTML) { |
| 44 // Set up necessary objects. | 44 // Set up necessary objects. |
| 45 scoped_nsobject<CRWJSPOSTRequestLoader> loader( | 45 scoped_nsobject<CRWJSPOSTRequestLoader> loader( |
| 46 [[CRWJSPOSTRequestLoader alloc] init]); | 46 [[CRWJSPOSTRequestLoader alloc] init]); |
| 47 scoped_nsobject<WKWebView> web_view( | 47 scoped_nsobject<WKWebView> web_view( |
| 48 web::CreateWKWebView(CGRectZero, GetBrowserState())); | 48 web::CreateWKWebView(CGRectZero, GetBrowserState())); |
| 49 WKUserContentController* contentController = | 49 WKUserContentController* contentController = |
| 50 web_view.get().configuration.userContentController; | 50 web_view.get().configuration.userContentController; |
| 51 scoped_nsobject<CRWWKScriptMessageRouter> messageRouter( | 51 scoped_nsobject<CRWWKScriptMessageRouter> messageRouter( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return complete; | 99 return complete; |
| 100 }); | 100 }); |
| 101 | 101 |
| 102 // Clean up installed script handler. | 102 // Clean up installed script handler. |
| 103 [messageRouter removeScriptMessageHandlerForName:@"XHRSendHandler" | 103 [messageRouter removeScriptMessageHandlerForName:@"XHRSendHandler" |
| 104 webView:web_view]; | 104 webView:web_view]; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace | 107 } // namespace |
| 108 } // namespace base | 108 } // namespace base |
| OLD | NEW |