Rename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it...
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2018 23:06:57 +0000 (23:06 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2018 23:06:57 +0000 (23:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191981

Reviewed by Tim Horton.

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _safeBrowsingWarning]):
(-[WKWebView _safeBrowsingWarningForTesting]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
(TEST):
(safeBrowsingView):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm

index 4e8d2eb..659f6fd 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-26  Alex Christensen  <achristensen@webkit.org>
+
+        Rename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it for more than testing
+        https://bugs.webkit.org/show_bug.cgi?id=191981
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _safeBrowsingWarning]):
+        (-[WKWebView _safeBrowsingWarningForTesting]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
 2018-11-26  Daniel Bates  <dabates@apple.com>
 
         REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore
index 2787e58..d247124 100644 (file)
@@ -4572,6 +4572,18 @@ FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(FORWARD_ACTION_TO_WKCONTENTVIEW)
     _page->process().terminate();
 }
 
+#if PLATFORM(MAC)
+- (NSView *)_safeBrowsingWarning
+{
+    return _impl->safeBrowsingWarning();
+}
+#else
+- (UIView *)_safeBrowsingWarning
+{
+    return _safeBrowsingWarning.get();
+}
+#endif
+
 - (WKNavigation *)_reloadWithoutContentBlockers
 {
     return wrapper(_page->reload(WebCore::ReloadOption::DisableContentBlockers));
@@ -6847,18 +6859,6 @@ static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISe
     _resolutionForShareSheetImmediateCompletionForTesting = resolved;
 }
 
-#if PLATFORM(MAC)
-- (NSView *)_safeBrowsingWarningForTesting
-{
-    return _impl->safeBrowsingWarning();
-}
-#else
-- (UIView *)_safeBrowsingWarningForTesting
-{
-    return _safeBrowsingWarning.get();
-}
-#endif
-
 - (_WKInspector *)_inspector
 {
     if (auto* inspector = _page->inspector())
index 5965023..d7c7364 100644 (file)
@@ -284,7 +284,9 @@ typedef NS_OPTIONS(NSUInteger, _WKRectEdge) {
 - (void)_accessibilityRetrieveSpeakSelectionContent WK_API_AVAILABLE(ios(11.0));
 - (void)_accessibilityDidGetSpeakSelectionContent:(NSString *)content WK_API_AVAILABLE(ios(11.0));
 
+@property (nonatomic, readonly) UIView *_safeBrowsingWarning WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 #else
+@property (nonatomic, readonly) NSView *_safeBrowsingWarning WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic, readonly) _WKRectEdge _pinnedState WK_API_AVAILABLE(macosx(10.13.4));
 @property (nonatomic, setter=_setRubberBandingEnabled:) _WKRectEdge _rubberBandingEnabled WK_API_AVAILABLE(macosx(10.13.4));
@@ -471,9 +473,7 @@ typedef NS_OPTIONS(NSUInteger, _WKRectEdge) {
 - (void)_accessibilityClearSelection WK_API_AVAILABLE(ios(11.3));
 - (UIView *)_fullScreenPlaceholderView WK_API_AVAILABLE(ios(12.0));
 
-@property (nonatomic, readonly) UIView *_safeBrowsingWarningForTesting WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 #else
-@property (nonatomic, readonly) NSView *_safeBrowsingWarningForTesting WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 - (void)_dismissContentRelativeChildWindows WK_API_AVAILABLE(macosx(10.13.4));
 - (void)_setFrame:(NSRect)rect andScrollBy:(NSSize)offset WK_API_AVAILABLE(macosx(10.13.4));
 - (void)_beginDeferringViewInWindowChanges WK_API_AVAILABLE(macosx(10.13.4));
index b51e38f..89531cd 100644 (file)
@@ -1,3 +1,14 @@
+2018-11-26  Alex Christensen  <achristensen@webkit.org>
+
+        Rename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it for more than testing
+        https://bugs.webkit.org/show_bug.cgi?id=191981
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
+        (TEST):
+        (safeBrowsingView):
+
 2018-11-26  Daniel Bates  <dabates@apple.com>
 
         REGRESSION (r237738): Command Down Arrow doesn't scroll to the end of a page anymore
index cf8f4ba..e1487cd 100644 (file)
@@ -157,13 +157,13 @@ TEST(SafeBrowsing, Preference)
     [webView setNavigationDelegate:delegate.get()];
     EXPECT_TRUE([webView configuration].preferences.safeBrowsingEnabled);
     [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
-    while (![webView _safeBrowsingWarningForTesting])
+    while (![webView _safeBrowsingWarning])
         TestWebKitAPI::Util::spinRunLoop();
     [webView configuration].preferences.safeBrowsingEnabled = NO;
     [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple2")]];
     TestWebKitAPI::Util::run(&done);
     EXPECT_FALSE([webView configuration].preferences.safeBrowsingEnabled);
-    EXPECT_FALSE([webView _safeBrowsingWarningForTesting]);
+    EXPECT_FALSE([webView _safeBrowsingWarning]);
 }
 
 static RetainPtr<WKWebView> safeBrowsingView()
@@ -174,10 +174,10 @@ static RetainPtr<WKWebView> safeBrowsingView()
     auto webView = adoptNS([WKWebView new]);
     [webView setNavigationDelegate:delegate.get()];
     [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
-    while (![webView _safeBrowsingWarningForTesting])
+    while (![webView _safeBrowsingWarning])
         TestWebKitAPI::Util::spinRunLoop();
 #if !PLATFORM(MAC)
-    [[webView _safeBrowsingWarningForTesting] didMoveToWindow];
+    [[webView _safeBrowsingWarning] didMoveToWindow];
 #endif
     return webView;
 }
@@ -201,16 +201,16 @@ static void checkTitleAndClick(UIButton *button, const char* expectedTitle)
 TEST(SafeBrowsing, GoBack)
 {
     auto webView = safeBrowsingView();
-    auto warning = [webView _safeBrowsingWarningForTesting];
+    auto warning = [webView _safeBrowsingWarning];
     auto box = warning.subviews.firstObject;
     checkTitleAndClick(box.subviews[3], "Go Back");
-    EXPECT_EQ([webView _safeBrowsingWarningForTesting], nil);
+    EXPECT_EQ([webView _safeBrowsingWarning], nil);
 }
 
 TEST(SafeBrowsing, VisitUnsafeWebsite)
 {
     auto webView = safeBrowsingView();
-    auto warning = [webView _safeBrowsingWarningForTesting];
+    auto warning = [webView _safeBrowsingWarning];
     EXPECT_EQ(warning.subviews.count, 1ull);
     checkTitleAndClick(warning.subviews.firstObject.subviews[4], "Show Details");
     EXPECT_EQ(warning.subviews.count, 2ull);
@@ -222,9 +222,9 @@ TEST(SafeBrowsing, VisitUnsafeWebsite)
 TEST(SafeBrowsing, NavigationClearsWarning)
 {
     auto webView = safeBrowsingView();
-    EXPECT_NE([webView _safeBrowsingWarningForTesting], nil);
+    EXPECT_NE([webView _safeBrowsingWarning], nil);
     [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
-    while ([webView _safeBrowsingWarningForTesting])
+    while ([webView _safeBrowsingWarning])
         TestWebKitAPI::Util::spinRunLoop();
 }
 
@@ -240,17 +240,17 @@ TEST(SafeBrowsing, ShowWarningSPI)
             completionHandlerCalled = true;
         }];
 #if !PLATFORM(MAC)
-        [[webView _safeBrowsingWarningForTesting] didMoveToWindow];
+        [[webView _safeBrowsingWarning] didMoveToWindow];
 #endif
     };
 
     showWarning();
-    checkTitleAndClick([webView _safeBrowsingWarningForTesting].subviews.firstObject.subviews[3], "Go Back");
+    checkTitleAndClick([webView _safeBrowsingWarning].subviews.firstObject.subviews[3], "Go Back");
     TestWebKitAPI::Util::run(&completionHandlerCalled);
     EXPECT_FALSE(shouldContinueValue);
 
     showWarning();
-    [[webView _safeBrowsingWarningForTesting] performSelector:NSSelectorFromString(@"clickedOnLink:") withObject:[WKWebView _visitUnsafeWebsiteSentinel]];
+    [[webView _safeBrowsingWarning] performSelector:NSSelectorFromString(@"clickedOnLink:") withObject:[WKWebView _visitUnsafeWebsiteSentinel]];
     TestWebKitAPI::Util::run(&completionHandlerCalled);
     EXPECT_TRUE(shouldContinueValue);
 }