| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ |
| 6 #define IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ | 6 #define IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ |
| 7 | 7 |
| 8 #include "base/ios/block_types.h" | 8 #include "base/ios/block_types.h" |
| 9 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "ios/web/public/test/web_test.h" | 11 #include "ios/web/public/test/web_test.h" |
| 12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 13 | 13 |
| 14 @class CRWWebController; | |
| 15 | |
| 16 namespace web { | 14 namespace web { |
| 17 | 15 |
| 18 class WebState; | 16 class WebState; |
| 19 | 17 |
| 20 // Base test fixture that provides WebState for testing. | 18 // Base test fixture that provides WebState for testing. |
| 21 class WebTestWithWebState : public WebTest, | 19 class WebTestWithWebState : public WebTest, |
| 22 public base::MessageLoop::TaskObserver { | 20 public base::MessageLoop::TaskObserver { |
| 23 protected: | 21 protected: |
| 24 WebTestWithWebState(); | 22 WebTestWithWebState(); |
| 25 ~WebTestWithWebState() override; | 23 ~WebTestWithWebState() override; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // LoadURL() for data URLs sometimes lock up navigation, so if the loaded page | 62 // LoadURL() for data URLs sometimes lock up navigation, so if the loaded page |
| 65 // is not the one expected, reset the web view. In some cases, document or | 63 // is not the one expected, reset the web view. In some cases, document or |
| 66 // document.body does not exist either; also reset in those cases. | 64 // document.body does not exist either; also reset in those cases. |
| 67 // Returns true if a reset occurred. One may want to load the page again. | 65 // Returns true if a reset occurred. One may want to load the page again. |
| 68 bool ResetPageIfNavigationStalled(NSString* load_check); | 66 bool ResetPageIfNavigationStalled(NSString* load_check); |
| 69 // Creates a unique HTML element to look for in | 67 // Creates a unique HTML element to look for in |
| 70 // ResetPageIfNavigationStalled(). | 68 // ResetPageIfNavigationStalled(). |
| 71 NSString* CreateLoadCheck(); | 69 NSString* CreateLoadCheck(); |
| 72 // The web state for testing. | 70 // The web state for testing. |
| 73 std::unique_ptr<WebState> web_state_; | 71 std::unique_ptr<WebState> web_state_; |
| 74 // The web controller for testing. | |
| 75 // TODO(crbug.com/619076): Remove this ivar. | |
| 76 base::WeakNSObject<CRWWebController> webController_; | |
| 77 }; | 72 }; |
| 78 | 73 |
| 79 } // namespace web | 74 } // namespace web |
| 80 | 75 |
| 81 #endif // IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ | 76 #endif // IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ |
| OLD | NEW |