Pull some API testing helper methods out of TestWKWebView
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Mar 2019 21:39:13 +0000 (21:39 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Mar 2019 21:39:13 +0000 (21:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196212

Reviewed by Tim Horton.

Refactor some more API testing utility methods, so that they can be used in
tests that do not use TestWKWebView.

* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[WKWebView loadTestPageNamed:]):
(-[WKWebView synchronouslyLoadHTMLString:baseURL:]):
(-[WKWebView synchronouslyLoadHTMLString:]):
(-[WKWebView synchronouslyLoadTestPageNamed:]):
(-[TestWKWebView loadTestPageNamed:]): Deleted.
(-[TestWKWebView synchronouslyLoadHTMLString:baseURL:]): Deleted.
(-[TestWKWebView synchronouslyLoadHTMLString:]): Deleted.
(-[TestWKWebView synchronouslyLoadTestPageNamed:]): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243462 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/TestWebKitAPI/cocoa/TestWKWebView.h
Tools/TestWebKitAPI/cocoa/TestWKWebView.mm

index 0c93148..e9544fe 100644 (file)
@@ -1,3 +1,24 @@
+2019-03-25  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Pull some API testing helper methods out of TestWKWebView
+        https://bugs.webkit.org/show_bug.cgi?id=196212
+
+        Reviewed by Tim Horton.
+
+        Refactor some more API testing utility methods, so that they can be used in
+        tests that do not use TestWKWebView.
+
+        * TestWebKitAPI/cocoa/TestWKWebView.h:
+        * TestWebKitAPI/cocoa/TestWKWebView.mm:
+        (-[WKWebView loadTestPageNamed:]):
+        (-[WKWebView synchronouslyLoadHTMLString:baseURL:]):
+        (-[WKWebView synchronouslyLoadHTMLString:]):
+        (-[WKWebView synchronouslyLoadTestPageNamed:]):
+        (-[TestWKWebView loadTestPageNamed:]): Deleted.
+        (-[TestWKWebView synchronouslyLoadHTMLString:baseURL:]): Deleted.
+        (-[TestWKWebView synchronouslyLoadHTMLString:]): Deleted.
+        (-[TestWKWebView synchronouslyLoadTestPageNamed:]): Deleted.
+
 2019-03-25  Jer Noble  <jer.noble@apple.com>
 
         Test for: 196095 Inband Text Track cues interspersed with Data cues can display out of order.
index c1b6d48..8ba652e 100644 (file)
 
 @interface WKWebView (TestWebKitAPI)
 @property (nonatomic, readonly) NSArray<NSString *> *tagsInBody;
+- (void)loadTestPageNamed:(NSString *)pageName;
+- (void)synchronouslyLoadHTMLString:(NSString *)html;
+- (void)synchronouslyLoadHTMLString:(NSString *)html baseURL:(NSURL *)url;
+- (void)synchronouslyLoadTestPageNamed:(NSString *)pageName;
 - (BOOL)_synchronouslyExecuteEditCommand:(NSString *)command argument:(NSString *)argument;
 - (void)expectElementTagsInOrder:(NSArray<NSString *> *)tagNames;
 - (void)expectElementCount:(NSInteger)count querySelector:(NSString *)querySelector;
 - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguration *)configuration addToWindow:(BOOL)addToWindow;
 - (void)clearMessageHandlers:(NSArray *)messageNames;
 - (void)performAfterReceivingMessage:(NSString *)message action:(dispatch_block_t)action;
-- (void)loadTestPageNamed:(NSString *)pageName;
-- (void)synchronouslyLoadHTMLString:(NSString *)html;
-- (void)synchronouslyLoadHTMLString:(NSString *)html baseURL:(NSURL *)url;
-- (void)synchronouslyLoadTestPageNamed:(NSString *)pageName;
 - (void)waitForMessage:(NSString *)message;
 - (void)performAfterLoading:(dispatch_block_t)actions;
 - (void)waitForNextPresentationUpdate;
index 09eb75e..4187ce3 100644 (file)
@@ -64,6 +64,29 @@ SOFT_LINK_CLASS(UIKit, UIWindow)
 
 @implementation WKWebView (TestWebKitAPI)
 
+- (void)loadTestPageNamed:(NSString *)pageName
+{
+    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:pageName withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+    [self loadRequest:request];
+}
+
+- (void)synchronouslyLoadHTMLString:(NSString *)html baseURL:(NSURL *)url
+{
+    [self loadHTMLString:html baseURL:url];
+    [self _test_waitForDidFinishNavigation];
+}
+
+- (void)synchronouslyLoadHTMLString:(NSString *)html
+{
+    [self synchronouslyLoadHTMLString:html baseURL:[[[NSBundle mainBundle] bundleURL] URLByAppendingPathComponent:@"TestWebKitAPI.resources"]];
+}
+
+- (void)synchronouslyLoadTestPageNamed:(NSString *)pageName
+{
+    [self loadTestPageNamed:pageName];
+    [self _test_waitForDidFinishNavigation];
+}
+
 - (BOOL)_synchronouslyExecuteEditCommand:(NSString *)command argument:(NSString *)argument
 {
     __block bool done = false;
@@ -343,29 +366,6 @@ static UICalloutBar *suppressUICalloutBar()
     [_testHandler addMessage:message withHandler:action];
 }
 
-- (void)loadTestPageNamed:(NSString *)pageName
-{
-    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:pageName withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
-    [self loadRequest:request];
-}
-
-- (void)synchronouslyLoadHTMLString:(NSString *)html baseURL:(NSURL *)url
-{
-    [self loadHTMLString:html baseURL:url];
-    [self _test_waitForDidFinishNavigation];
-}
-
-- (void)synchronouslyLoadHTMLString:(NSString *)html
-{
-    [self synchronouslyLoadHTMLString:html baseURL:[[[NSBundle mainBundle] bundleURL] URLByAppendingPathComponent:@"TestWebKitAPI.resources"]];
-}
-
-- (void)synchronouslyLoadTestPageNamed:(NSString *)pageName
-{
-    [self loadTestPageNamed:pageName];
-    [self _test_waitForDidFinishNavigation];
-}
-
 - (void)waitForMessage:(NSString *)message
 {
     __block bool isDoneWaiting = false;