Title: [123498] trunk/Tools
Revision
123498
Author
[email protected]
Date
2012-07-24 11:30:00 -0700 (Tue, 24 Jul 2012)

Log Message

Fix regressions in replay performance tests
https://bugs.webkit.org/show_bug.cgi?id=92052

Reviewed by Dirk Pranke.

Fix regression that accumulated over time to make replay tests work again.

* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::willSendRequest): Use the main document URL in the request since the main frame's
URL hadn't been updated yet When requesting a new URL on the main frame.
* Scripts/webkitpy/performance_tests/perftest.py:
(ReplayServer.wait_until_ready): Waiting for 6 seconds (3 tries) seems enough.
(ReplayPerfTest.prepare): Pass self._archive_path to run_signle as that is the current contract.
(ReplayPerfTest.run_single): Use the archive path to generate -expected.png path.
* Scripts/webkitpy/performance_tests/perftest_unittest.py:
(TestReplayPerfTest.test_run_single):
(TestReplayPerfTest.test_prepare):
(TestReplayPerfTest.test_prepare_calls_run_single.run_single):
(TestReplayPerfTest):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (123497 => 123498)


--- trunk/Tools/ChangeLog	2012-07-24 18:25:02 UTC (rev 123497)
+++ trunk/Tools/ChangeLog	2012-07-24 18:30:00 UTC (rev 123498)
@@ -1,3 +1,25 @@
+2012-07-23  Ryosuke Niwa  <[email protected]>
+
+        Fix regressions in replay performance tests
+        https://bugs.webkit.org/show_bug.cgi?id=92052
+
+        Reviewed by Dirk Pranke.
+
+        Fix regression that accumulated over time to make replay tests work again.
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::willSendRequest): Use the main document URL in the request since the main frame's
+        URL hadn't been updated yet When requesting a new URL on the main frame.
+        * Scripts/webkitpy/performance_tests/perftest.py:
+        (ReplayServer.wait_until_ready): Waiting for 6 seconds (3 tries) seems enough.
+        (ReplayPerfTest.prepare): Pass self._archive_path to run_signle as that is the current contract.
+        (ReplayPerfTest.run_single): Use the archive path to generate -expected.png path.
+        * Scripts/webkitpy/performance_tests/perftest_unittest.py:
+        (TestReplayPerfTest.test_run_single):
+        (TestReplayPerfTest.test_prepare):
+        (TestReplayPerfTest.test_prepare_calls_run_single.run_single):
+        (TestReplayPerfTest):
+
 2012-07-24  Simon Hausmann  <[email protected]>
 
         [Qt] MSVC: unresolved external symbol __DllMainCRTStartup@12

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (123497 => 123498)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-07-24 18:25:02 UTC (rev 123497)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-07-24 18:30:00 UTC (rev 123498)
@@ -1279,8 +1279,8 @@
     GURL url = ""
     string requestURL = url.possibly_invalid_spec();
 
+    GURL mainDocumentURL = request.firstPartyForCookies();
     if (layoutTestController()->shouldDumpResourceLoadCallbacks()) {
-        GURL mainDocumentURL = request.firstPartyForCookies();
         printResourceDescription(identifier);
         printf(" - willSendRequest <NSURLRequest URL %s, main document URL %s,"
                " http method %s> redirectResponse ",
@@ -1306,9 +1306,8 @@
 
     string host = url.host();
     if (!host.empty() && (url.SchemeIs("http") || url.SchemeIs("https"))) {
-        GURL testURL = webView()->mainFrame()->document().url();
-        const string& testHost = testURL.host();
-        if (!isLocalhost(host) && !hostIsUsedBySomeTestsToGenerateError(host) && ((!testURL.SchemeIs("http") && !testURL.SchemeIs("https")) || isLocalhost(testHost))
+        if (!isLocalhost(host) && !hostIsUsedBySomeTestsToGenerateError(host)
+            && ((!mainDocumentURL.SchemeIs("http") && !mainDocumentURL.SchemeIs("https")) || isLocalhost(mainDocumentURL.host()))
             && !m_shell->allowExternalPages()) {
             printf("Blocked access to external URL %s\n", requestURL.c_str());
             blockRequest(request);

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftest.py (123497 => 123498)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftest.py	2012-07-24 18:25:02 UTC (rev 123497)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftest.py	2012-07-24 18:30:00 UTC (rev 123498)
@@ -232,7 +232,7 @@
         self._process = subprocess.Popen(args)
 
     def wait_until_ready(self):
-        for i in range(0, 10):
+        for i in range(0, 3):
             try:
                 connection = socket.create_connection(('localhost', '8080'), timeout=1)
                 connection.close()
@@ -281,7 +281,7 @@
 
         driver = self._port.create_driver(worker_number=1, no_timeout=True)
         try:
-            output = self.run_single(driver, self._url, time_out_ms, record=True)
+            output = self.run_single(driver, self._archive_path, time_out_ms, record=True)
         finally:
             driver.stop()
 
@@ -300,6 +300,7 @@
             return None
 
         try:
+            _log.debug("Waiting for Web page replay to start.")
             if not server.wait_until_ready():
                 _log.error("Web page replay didn't start.")
                 return None
@@ -317,8 +318,8 @@
                 return None
 
             filesystem = self._port.host.filesystem
-            dirname = filesystem.dirname(url)
-            filename = filesystem.split(url)[1]
+            dirname = filesystem.dirname(self._archive_path)
+            filename = filesystem.split(self._archive_path)[1]
             writer = TestResultWriter(filesystem, self._port, dirname, filename)
             if record:
                 writer.write_image_files(actual_image=None, expected_image=output.image)

Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py (123497 => 123498)


--- trunk/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py	2012-07-24 18:25:02 UTC (rev 123497)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py	2012-07-24 18:30:00 UTC (rev 123498)
@@ -156,7 +156,7 @@
 
     def _add_file(self, port, dirname, filename, content=True):
         port.host.filesystem.maybe_make_directory(dirname)
-        port.host.filesystem.files[port.host.filesystem.join(dirname, filename)] = content
+        port.host.filesystem.write_binary_file(port.host.filesystem.join(dirname, filename), content)
 
     def _setup_test(self, run_test=None):
         test_port = self.ReplayTestPort(run_test)
@@ -195,6 +195,7 @@
         self.assertEqual(actual_stdout, '')
         self.assertEqual(actual_stderr, '')
         self.assertEqual(actual_logs, '')
+        self.assertEqual(port.host.filesystem.read_binary_file('/path/some-dir/some-test-actual.png'), 'actual image')
 
     def test_run_single_fails_without_webpagereplay(self):
         output_capture = OutputCapture()
@@ -281,6 +282,7 @@
         self.assertEqual(actual_stdout, '')
         self.assertEqual(actual_stderr, '')
         self.assertEqual(actual_logs, 'Preparing replay for some-test.replay\nPrepared replay for some-test.replay\n')
+        self.assertEqual(port.host.filesystem.read_binary_file('/path/some-dir/some-test-expected.png'), 'actual image')
 
     def test_prepare_calls_run_single(self):
         output_capture = OutputCapture()
@@ -289,7 +291,7 @@
 
         def run_single(driver, url, time_out_ms, record):
             self.assertTrue(record)
-            self.assertEqual(url, 'http://some-test/')
+            self.assertEqual(url, '/path/some-dir/some-test.wpr')
             called[0] = True
             return False
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to