[WKTR] Allow changing the WKContextConfiguration between successive tests
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Sep 2015 02:31:34 +0000 (02:31 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Sep 2015 02:31:34 +0000 (02:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148833

Reviewed by Tim Horton.

Previously, we were creating a single WKContext and it lived for the life of the entire test runner.
However, there are certain tests which require specifying options in this object. This patch makes
our existing code for recreating the test runner web view also recreate the WKContext.

As such, our options to the view are now options to the WKContextConfiguration. This patch renames the
class.

* WebKitTestRunner/ContextConfigurationOptions.h: Renamed from Tools/WebKitTestRunner/ViewOptions.h.
* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::options):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
(WTR::TestController::generateContextConfiguration):
(WTR::TestController::generatePageConfiguration):
(WTR::TestController::createWebViewWithOptions):
(WTR::TestController::ensureViewSupportsOptionsForTest):
(WTR::updateContextConfigurationOptionsFromTestHeader):
(WTR::TestController::contextConfigurationOptionsForTest):
(WTR::TestController::platformCreateWebView):
(WTR::TestController::platformCreateOtherPage):
(WTR::updateViewOptionsFromTestHeader): Deleted.
(WTR::TestController::viewOptionsForTest): Deleted.
* WebKitTestRunner/TestController.h:
(WTR::TestController::injectedBundlePath):
(WTR::TestController::testPluginDirectory):
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::platformCreateWebView):
(WTR::TestController::platformCreateOtherPage):
* WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::viewSupportsOptions):
* WebKitTestRunner/efl/TestControllerEfl.cpp:
(WTR::TestController::updatePlatformSpecificContextConfigurationOptionsForTest):
(WTR::TestController::updatePlatformSpecificViewOptionsForTest): Deleted.
* WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::viewSupportsOptions):
* WebKitTestRunner/gtk/TestControllerGtk.cpp:
(WTR::TestController::updatePlatformSpecificContextConfigurationOptionsForTest):
(WTR::TestController::updatePlatformSpecificViewOptionsForTest): Deleted.
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::viewSupportsOptions):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::updatePlatformSpecificContextConfigurationOptionsForTest):
(WTR::TestController::updatePlatformSpecificViewOptionsForTest): Deleted.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::viewSupportsOptions):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::updatePlatformSpecificContextConfigurationOptionsForTest):
(WTR::TestController::updatePlatformSpecificViewOptionsForTest): Deleted.

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

17 files changed:
Tools/ChangeLog
Tools/WebKitTestRunner/PlatformWebView.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestOptions.h [moved from Tools/WebKitTestRunner/ViewOptions.h with 92% similarity]
Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
Tools/WebKitTestRunner/WebNotificationProvider.cpp
Tools/WebKitTestRunner/WebNotificationProvider.h
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp
Tools/WebKitTestRunner/efl/TestControllerEfl.cpp
Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp
Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp
Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
Tools/WebKitTestRunner/ios/TestControllerIOS.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Tools/WebKitTestRunner/mac/TestControllerMac.mm

index d0959d0..d89660d 100644 (file)
@@ -1,3 +1,64 @@
+2015-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [WKTR] Allow changing the WKContextConfiguration between successive tests
+        https://bugs.webkit.org/show_bug.cgi?id=148833
+
+        Reviewed by Tim Horton.
+
+        Previously, we were creating a single WKContext and it lived for the life of the entire test runner.
+        However, there are certain tests which require specifying options in this object. This patch makes
+        our existing code for recreating the test runner web view also recreate the WKContext.
+
+        As such, our options to the view are now options to the WKContextConfiguration. This patch renames the
+        class.
+
+        * WebKitTestRunner/ContextConfigurationOptions.h: Renamed from Tools/WebKitTestRunner/ViewOptions.h.
+        * WebKitTestRunner/PlatformWebView.h:
+        (WTR::PlatformWebView::options):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+        (WTR::TestController::generateContextConfiguration):
+        (WTR::TestController::generatePageConfiguration):
+        (WTR::TestController::createWebViewWithOptions):
+        (WTR::TestController::ensureViewSupportsOptionsForTest):
+        (WTR::updateContextConfigurationOptionsFromTestHeader):
+        (WTR::TestController::contextConfigurationOptionsForTest):
+        (WTR::TestController::platformCreateWebView):
+        (WTR::TestController::platformCreateOtherPage):
+        (WTR::updateViewOptionsFromTestHeader): Deleted.
+        (WTR::TestController::viewOptionsForTest): Deleted.
+        * WebKitTestRunner/TestController.h:
+        (WTR::TestController::injectedBundlePath):
+        (WTR::TestController::testPluginDirectory):
+        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::platformCreateWebView):
+        (WTR::TestController::platformCreateOtherPage):
+        * WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
+        (WTR::PlatformWebView::PlatformWebView):
+        (WTR::PlatformWebView::viewSupportsOptions):
+        * WebKitTestRunner/efl/TestControllerEfl.cpp:
+        (WTR::TestController::updatePlatformSpecificContextConfigurationOptionsForTest):
+        (WTR::TestController::updatePlatformSpecificViewOptionsForTest): Deleted.
+        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
+        (WTR::PlatformWebView::PlatformWebView):
+        (WTR::PlatformWebView::viewSupportsOptions):
+        * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+        (WTR::TestController::updatePlatformSpecificContextConfigurationOptionsForTest):
+        (WTR::TestController::updatePlatformSpecificViewOptionsForTest): Deleted.
+        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+        (WTR::PlatformWebView::PlatformWebView):
+        (WTR::PlatformWebView::viewSupportsOptions):
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::updatePlatformSpecificContextConfigurationOptionsForTest):
+        (WTR::TestController::updatePlatformSpecificViewOptionsForTest): Deleted.
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::PlatformWebView):
+        (WTR::PlatformWebView::viewSupportsOptions):
+        * WebKitTestRunner/mac/TestControllerMac.mm:
+        (WTR::TestController::updatePlatformSpecificContextConfigurationOptionsForTest):
+        (WTR::TestController::updatePlatformSpecificViewOptionsForTest): Deleted.
+
 2015-09-11  Michael Saboff  <msaboff@apple.com>
 
         LayoutTestHelper crashes if a color profile isn't set for a 3rd party monitor
index 9688c4c..52c8beb 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef PlatformWebView_h
 #define PlatformWebView_h
 
-#include "ViewOptions.h"
+#include "TestOptions.h"
 #include <WebKit/WKRetainPtr.h>
 
 #if PLATFORM(COCOA)
@@ -57,9 +57,9 @@ namespace WTR {
 class PlatformWebView {
 public:
 #if PLATFORM(COCOA)
-    PlatformWebView(WKWebViewConfiguration*, const ViewOptions&);
+    PlatformWebView(WKWebViewConfiguration*, const TestOptions&);
 #else
-    PlatformWebView(WKPageConfigurationRef, const ViewOptions&);
+    PlatformWebView(WKPageConfigurationRef, const TestOptions&);
 #endif
     ~PlatformWebView();
 
@@ -80,10 +80,10 @@ public:
     void setWindowIsKey(bool isKey) { m_windowIsKey = isKey; }
     bool windowIsKey() const { return m_windowIsKey; }
 
-    bool viewSupportsOptions(const ViewOptions&) const;
+    bool viewSupportsOptions(const TestOptions&) const;
 
     WKRetainPtr<WKImageRef> windowSnapshotImage();
-    const ViewOptions& options() const { return m_options; }
+    const TestOptions& options() const { return m_options; }
 
     void changeWindowScaleIfNeeded(float newScale);
     void setNavigationGesturesEnabled(bool);
@@ -98,7 +98,7 @@ private:
     PlatformWKView m_view;
     PlatformWindow m_window;
     bool m_windowIsKey;
-    const ViewOptions m_options;
+    const TestOptions m_options;
 
 #if PLATFORM(EFL)
     bool m_usingFixedLayout;
index a6460aa..bec727f 100644 (file)
@@ -368,7 +368,10 @@ void TestController::initialize(int argc, const char* argv[])
 
     WKRetainPtr<WKStringRef> pageGroupIdentifier(AdoptWK, WKStringCreateWithUTF8CString("WebKitTestRunnerPageGroup"));
     m_pageGroup.adopt(WKPageGroupCreateWithIdentifier(pageGroupIdentifier.get()));
+}
 
+WKRetainPtr<WKContextConfigurationRef> TestController::generateContextConfiguration() const
+{
     auto configuration = adoptWK(WKContextConfigurationCreate());
     WKContextConfigurationSetInjectedBundlePath(configuration.get(), injectedBundlePath());
     WKContextConfigurationSetFullySynchronousModeIsAllowedForTesting(configuration.get(), true);
@@ -385,7 +388,12 @@ void TestController::initialize(int argc, const char* argv[])
         WKContextConfigurationSetWebSQLDatabaseDirectory(configuration.get(), toWK(temporaryFolder + separator + "Databases" + separator + "WebSQL").get());
         WKContextConfigurationSetMediaKeysStorageDirectory(configuration.get(), toWK(temporaryFolder + separator + "MediaKeys").get());
     }
-    m_context = platformAdjustContext(adoptWK(WKContextCreateWithConfiguration(configuration.get())).get(), configuration.get());
+    return configuration;
+}
+
+WKRetainPtr<WKPageConfigurationRef> TestController::generatePageConfiguration(WKContextConfigurationRef configuration)
+{
+    m_context = platformAdjustContext(adoptWK(WKContextCreateWithConfiguration(configuration)).get(), configuration);
 
     m_geolocationProvider = std::make_unique<GeolocationProviderMock>(m_context.get());
 
@@ -445,18 +453,24 @@ void TestController::initialize(int argc, const char* argv[])
     if (m_forceComplexText)
         WKContextSetAlwaysUsesComplexTextCodePath(m_context.get(), true);
 
-    m_configuration = adoptWK(WKPageConfigurationCreate());
-    WKPageConfigurationSetContext(m_configuration.get(), m_context.get());
-    WKPageConfigurationSetPageGroup(m_configuration.get(), m_pageGroup.get());
-    WKPageConfigurationSetUserContentController(m_configuration.get(), adoptWK(WKUserContentControllerCreate()).get());
+    auto pageConfiguration = adoptWK(WKPageConfigurationCreate());
+    WKPageConfigurationSetContext(pageConfiguration.get(), m_context.get());
+    WKPageConfigurationSetPageGroup(pageConfiguration.get(), m_pageGroup.get());
+    WKPageConfigurationSetUserContentController(pageConfiguration.get(), adoptWK(WKUserContentControllerCreate()).get());
+    return pageConfiguration;
+}
+
+void TestController::createWebViewWithOptions(const TestOptions& options)
+{
+    auto contextConfiguration = generateContextConfiguration();
+    // Modify contextConfiguration here.
+    auto configuration = generatePageConfiguration(contextConfiguration.get());
 
     // Some preferences (notably mock scroll bars setting) currently cannot be re-applied to an existing view, so we need to set them now.
+    // FIXME: Migrate these preferences to WKContextConfigurationRef.
     resetPreferencesToConsistentValues();
-}
 
-void TestController::createWebViewWithOptions(const ViewOptions& options)
-{
-    platformCreateWebView(m_configuration.get(), options);
+    platformCreateWebView(configuration.get(), options);
     WKPageUIClientV6 pageUIClient = {
         { 6, m_mainWebView.get() },
         0, // createNewPage_deprecatedForUseWithV0
@@ -564,10 +578,10 @@ void TestController::createWebViewWithOptions(const ViewOptions& options)
 
 void TestController::ensureViewSupportsOptionsForTest(const TestInvocation& test)
 {
-    auto viewOptions = viewOptionsForTest(test);
+    auto options = testOptionsForTest(test);
 
     if (m_mainWebView) {
-        if (m_mainWebView->viewSupportsOptions(viewOptions))
+        if (m_mainWebView->viewSupportsOptions(options))
             return;
 
         WKPageSetPageUIClient(m_mainWebView->page(), nullptr);
@@ -577,7 +591,7 @@ void TestController::ensureViewSupportsOptionsForTest(const TestInvocation& test
         m_mainWebView = nullptr;
     }
 
-    createWebViewWithOptions(viewOptions);
+    createWebViewWithOptions(options);
 
     if (!resetStateToConsistentValues())
         TestInvocation::dumpWebProcessUnresponsiveness("<unknown> - TestController::run - Failed to reset state to consistent values\n");
@@ -808,7 +822,7 @@ static std::string testPath(const WKURLRef url)
     return std::string();
 }
 
-static void updateViewOptionsFromTestHeader(ViewOptions& viewOptions, const TestInvocation& test)
+static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const TestInvocation& test)
 {
     std::string filename = testPath(test.url());
     if (filename.empty())
@@ -842,24 +856,24 @@ static void updateViewOptionsFromTestHeader(ViewOptions& viewOptions, const Test
         }
         auto key = pairString.substr(pairStart, equalsLocation - pairStart);
         auto value = pairString.substr(equalsLocation + 1, pairEnd - (equalsLocation + 1));
-        // Options processing to modify viewOptions goes here.
+        // Options processing to modify testOptions goes here.
         pairStart = pairEnd + 1;
     }
 }
 
-ViewOptions TestController::viewOptionsForTest(const TestInvocation& test) const
+TestOptions TestController::testOptionsForTest(const TestInvocation& test) const
 {
-    ViewOptions viewOptions;
+    TestOptions options;
 
-    viewOptions.useRemoteLayerTree = m_shouldUseRemoteLayerTree;
-    viewOptions.shouldShowWebView = m_shouldShowWebView;
-    viewOptions.useFixedLayout = shouldUseFixedLayout(test);
+    options.useRemoteLayerTree = m_shouldUseRemoteLayerTree;
+    options.shouldShowWebView = m_shouldShowWebView;
+    options.useFixedLayout = shouldUseFixedLayout(test);
 
-    updateViewOptionsFromTestHeader(viewOptions, test);
+    updateTestOptionsFromTestHeader(options, test);
 
-    updatePlatformSpecificViewOptionsForTest(viewOptions, test);
+    updatePlatformSpecificTestOptionsForTest(options, test);
 
-    return viewOptions;
+    return options;
 }
 
 void TestController::updateWebViewSizeForTest(const TestInvocation& test)
@@ -1767,12 +1781,12 @@ void TestController::platformWillRunTest(const TestInvocation&)
 {
 }
 
-void TestController::platformCreateWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
+void TestController::platformCreateWebView(WKPageConfigurationRef configuration, const TestOptions& options)
 {
     m_mainWebView = std::make_unique<PlatformWebView>(configuration, options);
 }
 
-PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef configuration, const ViewOptions& options)
+PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef configuration, const TestOptions& options)
 {
     return new PlatformWebView(configuration, options);
 }
index 22f89d8..a6d9af5 100644 (file)
@@ -41,7 +41,7 @@ namespace WTR {
 class TestInvocation;
 class PlatformWebView;
 class EventSenderProxy;
-struct ViewOptions;
+struct TestOptions;
 
 // FIXME: Rename this TestRunner?
 class TestController {
@@ -62,8 +62,8 @@ public:
 
     bool verbose() const { return m_verbose; }
 
-    WKStringRef injectedBundlePath() { return m_injectedBundlePath.get(); }
-    WKStringRef testPluginDirectory() { return m_testPluginDirectory.get(); }
+    WKStringRef injectedBundlePath() const { return m_injectedBundlePath.get(); }
+    WKStringRef testPluginDirectory() const { return m_testPluginDirectory.get(); }
 
     PlatformWebView* mainWebView() { return m_mainWebView.get(); }
     WKContextRef context() { return m_context.get(); }
@@ -129,8 +129,10 @@ public:
     void setNavigationGesturesEnabled(bool value);
 
 private:
+    WKRetainPtr<WKPageConfigurationRef> generatePageConfiguration(WKContextConfigurationRef);
+    WKRetainPtr<WKContextConfigurationRef> generateContextConfiguration() const;
     void initialize(int argc, const char* argv[]);
-    void createWebViewWithOptions(const ViewOptions&);
+    void createWebViewWithOptions(const TestOptions&);
     void run();
 
     void runTestingServerLoop();
@@ -140,8 +142,8 @@ private:
     void platformDestroy();
     WKContextRef platformAdjustContext(WKContextRef, WKContextConfigurationRef);
     void platformInitializeContext();
-    void platformCreateWebView(WKPageConfigurationRef, const ViewOptions&);
-    static PlatformWebView* platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const ViewOptions&);
+    void platformCreateWebView(WKPageConfigurationRef, const TestOptions&);
+    static PlatformWebView* platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const TestOptions&);
     void platformResetPreferencesToConsistentValues();
     void platformResetStateToConsistentValues();
 #if PLATFORM(COCOA)
@@ -156,8 +158,8 @@ private:
     void initializeTestPluginDirectory();
 
     void ensureViewSupportsOptionsForTest(const TestInvocation&);
-    ViewOptions viewOptionsForTest(const TestInvocation&) const;
-    void updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const;
+    TestOptions testOptionsForTest(const TestInvocation&) const;
+    void updatePlatformSpecificTestOptionsForTest(TestOptions&, const TestInvocation&) const;
 
     void updateWebViewSizeForTest(const TestInvocation&);
     void updateWindowScaleForTest(PlatformWebView*, const TestInvocation&);
@@ -258,7 +260,6 @@ private:
     std::unique_ptr<PlatformWebView> m_mainWebView;
     WKRetainPtr<WKContextRef> m_context;
     WKRetainPtr<WKPageGroupRef> m_pageGroup;
-    WKRetainPtr<WKPageConfigurationRef> m_configuration;
 
     enum State {
         Initial,
similarity index 92%
rename from Tools/WebKitTestRunner/ViewOptions.h
rename to Tools/WebKitTestRunner/TestOptions.h
index f460af7..eb801ce 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ViewOptions_h
-#define ViewOptions_h
+#ifndef TestOptions_h
+#define TestOptions_h
 
 namespace WTR {
 
-struct ViewOptions {
+struct TestOptions {
     bool useThreadedScrolling { false };
     bool useRemoteLayerTree { false };
     bool shouldShowWebView { false };
-    bool useTiledDrawing { false };
 
     bool useFixedLayout { false };
 };
 
 }
 
-#endif // ViewOptions_h
+#endif // TestOptions_h
index 15cbf1c..e8ca5ba 100644 (file)
                0FEB909E1905A776000FDBF3 /* InjectedBundlePageCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundlePageCocoa.mm; sourceTree = "<group>"; };
                0FEB90A21905BC6A000FDBF3 /* CrashReporterInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CrashReporterInfo.h; path = cocoa/CrashReporterInfo.h; sourceTree = "<group>"; };
                0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CrashReporterInfo.mm; path = cocoa/CrashReporterInfo.mm; sourceTree = "<group>"; };
-               1A3326051B75396500F89F62 /* ViewOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewOptions.h; sourceTree = "<group>"; };
+               1A3326051B75396500F89F62 /* TestOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestOptions.h; sourceTree = "<group>"; };
                26D758E5160BECDC00268472 /* GeolocationProviderMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationProviderMock.cpp; sourceTree = "<group>"; };
                26D758E6160BECDD00268472 /* GeolocationProviderMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationProviderMock.h; sourceTree = "<group>"; };
                29210EA2144CAAA500835BB5 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = "<group>"; };
                                BC79342F118F7F19005EA8E2 /* TestController.h */,
                                BCD7D2F711921278006DB7EE /* TestInvocation.cpp */,
                                BCD7D2F611921278006DB7EE /* TestInvocation.h */,
-                               1A3326051B75396500F89F62 /* ViewOptions.h */,
+                               1A3326051B75396500F89F62 /* TestOptions.h */,
                                BC251A1711D16774002EBC01 /* WebKitTestRunnerPrefix.h */,
                                3164C8EF15D1ADA100EF1FE0 /* WebNotificationProvider.cpp */,
                                3110BE0F15BA011400D216AC /* WebNotificationProvider.h */,
index a46aabc..f1c7bea 100644 (file)
@@ -65,8 +65,8 @@ WebNotificationProvider::WebNotificationProvider()
 
 WebNotificationProvider::~WebNotificationProvider()
 {
-    if (m_notificationManager)
-        WKNotificationManagerSetProvider(m_notificationManager.get(), nullptr);
+    if (m_currentNotificationManager)
+        WKNotificationManagerSetProvider(m_currentNotificationManager.get(), nullptr);
 }
 
 WKNotificationProviderV0 WebNotificationProvider::provider()
@@ -86,19 +86,19 @@ WKNotificationProviderV0 WebNotificationProvider::provider()
 
 void WebNotificationProvider::showWebNotification(WKPageRef, WKNotificationRef notification)
 {
-    if (!m_notificationManager)
+    if (!m_currentNotificationManager)
         return;
 
     uint64_t id = WKNotificationGetID(notification);
     ASSERT(!m_shownNotifications.contains(id));
     m_shownNotifications.add(id);
 
-    WKNotificationManagerProviderDidShowNotification(m_notificationManager.get(), WKNotificationGetID(notification));
+    WKNotificationManagerProviderDidShowNotification(m_currentNotificationManager.get(), WKNotificationGetID(notification));
 }
 
 void WebNotificationProvider::closeWebNotification(WKNotificationRef notification)
 {
-    if (!m_notificationManager)
+    if (!m_currentNotificationManager)
         return;
 
     uint64_t id = WKNotificationGetID(notification);
@@ -106,22 +106,16 @@ void WebNotificationProvider::closeWebNotification(WKNotificationRef notificatio
     WKRetainPtr<WKMutableArrayRef> array(AdoptWK, WKMutableArrayCreate());
     WKArrayAppendItem(array.get(), wkID.get());
     m_shownNotifications.remove(id);
-    WKNotificationManagerProviderDidCloseNotifications(m_notificationManager.get(), array.get());
+    WKNotificationManagerProviderDidCloseNotifications(m_currentNotificationManager.get(), array.get());
 }
 
 void WebNotificationProvider::addNotificationManager(WKNotificationManagerRef manager)
 {
-    // We assume there is only one for testing.
-    ASSERT(!m_notificationManager);
-    m_notificationManager = manager;
+    m_currentNotificationManager = manager;
 }
 
 void WebNotificationProvider::removeNotificationManager(WKNotificationManagerRef manager)
 {
-    // We assume there is only one for testing.
-    ASSERT(m_notificationManager);
-    ASSERT(m_notificationManager.get() == manager);
-    m_notificationManager = 0;
 }
 
 WKDictionaryRef WebNotificationProvider::notificationPermissions()
@@ -132,16 +126,16 @@ WKDictionaryRef WebNotificationProvider::notificationPermissions()
 
 void WebNotificationProvider::simulateWebNotificationClick(uint64_t notificationID)
 {
-    if (!m_notificationManager)
+    if (!m_currentNotificationManager)
         return;
 
     ASSERT(m_shownNotifications.contains(notificationID));
-    WKNotificationManagerProviderDidClickNotification(m_notificationManager.get(), notificationID);
+    WKNotificationManagerProviderDidClickNotification(m_currentNotificationManager.get(), notificationID);
 }
 
 void WebNotificationProvider::reset()
 {
-    if (!m_notificationManager) {
+    if (!m_currentNotificationManager) {
         m_shownNotifications.clear();
         return;
     }
@@ -154,7 +148,7 @@ void WebNotificationProvider::reset()
     }
 
     m_shownNotifications.clear();
-    WKNotificationManagerProviderDidCloseNotifications(m_notificationManager.get(), array.get());
+    WKNotificationManagerProviderDidCloseNotifications(m_currentNotificationManager.get(), array.get());
 }
 
 } // namespace WTR
index 402d110..46bf31b 100644 (file)
@@ -49,7 +49,7 @@ public:
     void reset();
 
 private:
-    WKRetainPtr<WKNotificationManagerRef> m_notificationManager;
+    WKRetainPtr<WKNotificationManagerRef> m_currentNotificationManager;
     HashSet<uint64_t> m_shownNotifications;
 };
 
index e653b89..2b4f4cc 100644 (file)
@@ -50,10 +50,10 @@ static WKWebViewConfiguration *globalWebViewConfiguration;
 void initializeWebViewConfiguration(const char* libraryPath, WKStringRef injectedBundlePath, WKContextRef context, WKContextConfigurationRef contextConfiguration)
 {
 #if WK_API_ENABLED
-    ASSERT(!globalWebViewConfiguration);
+    [globalWebViewConfiguration release];
     globalWebViewConfiguration = [[WKWebViewConfiguration alloc] init];
 
-    globalWebViewConfiguration.processPool = [[WKProcessPool alloc] _initWithConfiguration:(_WKProcessPoolConfiguration *)contextConfiguration];
+    globalWebViewConfiguration.processPool = WTF::adoptNS([[WKProcessPool alloc] _initWithConfiguration:(_WKProcessPoolConfiguration *)contextConfiguration]).get();
     globalWebViewConfiguration.websiteDataStore = (WKWebsiteDataStore *)WKContextGetWebsiteDataStore(context);
 
 #if TARGET_OS_IPHONE
@@ -74,12 +74,12 @@ WKPreferencesRef TestController::platformPreferences()
 #endif
 }
 
-void TestController::platformCreateWebView(WKPageConfigurationRef, const ViewOptions& options)
+void TestController::platformCreateWebView(WKPageConfigurationRef, const TestOptions& options)
 {
     m_mainWebView = std::make_unique<PlatformWebView>(globalWebViewConfiguration, options);
 }
 
-PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const ViewOptions& options)
+PlatformWebView* TestController::platformCreateOtherPage(PlatformWebView* parentView, WKPageConfigurationRef, const TestOptions& options)
 {
 #if WK_API_ENABLED
     WKWebViewConfiguration *newConfiguration = [[globalWebViewConfiguration copy] autorelease];
index d136aa5..b222d60 100644 (file)
@@ -53,7 +53,7 @@ static Ecore_Evas* initEcoreEvas()
     return ecoreEvas;
 }
 
-PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
+PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const TestOptions& options)
     : m_options(options)
 {
     WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout"));
@@ -144,7 +144,7 @@ WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
     return adoptWK(WKViewCreateSnapshot(EWKViewGetWKView(m_view)));
 }
 
-bool PlatformWebView::viewSupportsOptions(const ViewOptions& options) const
+bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
 {
     if (m_options.useFixedLayout != options.useFixedLayout)
         return false;
index 26741f5..aaae88b 100644 (file)
@@ -148,9 +148,9 @@ static bool shouldUseFixedLayout(const TestInvocation& test)
     return false;
 }
 
-void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions& viewOptions, const TestInvocation& test) const
+void TestController::updatePlatformSpecificTestOptionsForTest(TestOptions& testOptions, const TestInvocation& test) const
 {
-    viewOptions.useFixedLayout = shouldUseFixedLayout(test);
+    testOptions.useFixedLayout = shouldUseFixedLayout(test);
 }
 
 void TestController::platformConfigureViewForTest(const TestInvocation&)
index ad9b027..ff18f84 100644 (file)
@@ -36,7 +36,7 @@
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const ViewOptions& options)
+PlatformWebView::PlatformWebView(WKPageConfigurationRef configuration, const TestOptions& options)
     : m_view(WKViewCreate(configuration))
     , m_window(gtk_window_new(GTK_WINDOW_POPUP))
     , m_windowIsKey(true)
@@ -142,7 +142,7 @@ void PlatformWebView::didInitializeClients()
 {
 }
 
-bool PlatformWebView::viewSupportsOptions(const ViewOptions&) const
+bool PlatformWebView::viewSupportsOptions(const TestOptions&) const
 {
     return true;
 }
index d81ab5c..0a7f8a9 100644 (file)
@@ -128,7 +128,7 @@ void TestController::platformResetPreferencesToConsistentValues()
     m_mainWebView->dismissAllPopupMenus();
 }
 
-void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const
+void TestController::updatePlatformSpecificTestOptionsForTest(TestOptions&, const TestInvocation&) const
 {
 }
 
index 2e9c511..6a1f47a 100644 (file)
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const ViewOptions& options)
+PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const TestOptions& options)
     : m_windowIsKey(true)
     , m_options(options)
 {
@@ -202,7 +202,7 @@ WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
     return nullptr;
 }
 
-bool PlatformWebView::viewSupportsOptions(const ViewOptions& options) const
+bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
 {
     return true;
 }
index 167161e..f6a1d3c 100644 (file)
@@ -102,7 +102,7 @@ void TestController::platformConfigureViewForTest(const TestInvocation& test)
     }
 }
 
-void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions&, const TestInvocation&) const
+void TestController::updatePlatformSpecificTestOptionsForTest(TestOptions&, const TestInvocation&) const
 {
 }
 
index 81a20cc..e974dda 100644 (file)
@@ -114,7 +114,7 @@ enum {
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const ViewOptions& options)
+PlatformWebView::PlatformWebView(WKWebViewConfiguration* configuration, const TestOptions& options)
     : m_windowIsKey(true)
     , m_options(options)
 {
@@ -240,7 +240,7 @@ WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
     return adoptWK(WKImageCreateFromCGImage(windowSnapshotImage.get(), 0));
 }
 
-bool PlatformWebView::viewSupportsOptions(const ViewOptions& options) const
+bool PlatformWebView::viewSupportsOptions(const TestOptions& options) const
 {
     if (m_options.useThreadedScrolling != options.useThreadedScrolling)
         return false;
index 8380a9f..af393b2 100644 (file)
@@ -95,11 +95,11 @@ void TestController::platformResetStateToConsistentValues()
     }
 }
 
-void TestController::updatePlatformSpecificViewOptionsForTest(ViewOptions& viewOptions, const TestInvocation& test) const
+void TestController::updatePlatformSpecificTestOptionsForTest(TestOptions& options, const TestInvocation& test) const
 {
-    viewOptions.useThreadedScrolling = shouldUseThreadedScrolling(test);
-    viewOptions.useRemoteLayerTree = shouldUseRemoteLayerTree();
-    viewOptions.shouldShowWebView = shouldShowWebView();
+    options.useThreadedScrolling = shouldUseThreadedScrolling(test);
+    options.useRemoteLayerTree = shouldUseRemoteLayerTree();
+    options.shouldShowWebView = shouldShowWebView();
 }
 
 void TestController::platformConfigureViewForTest(const TestInvocation& test)