Title: [142153] trunk/Source/WebKit2
Revision
142153
Author
[email protected]
Date
2013-02-07 10:49:45 -0800 (Thu, 07 Feb 2013)

Log Message

[EFL][WK2] EWK2UnitTestBase.ewk_view_page_contents_get API test is sometimes failing
https://bugs.webkit.org/show_bug.cgi?id=108634

Patch by Christophe Dumez <[email protected]> on 2013-02-07
Reviewed by Alexey Proskuryakov.

Use more robust data validation in EWK2UnitTestBase.ewk_view_page_contents_get
so that the test passes consistently. The issue was that the header before the
data includes the current date. Depending on the date, the data may start at a
different index in the returned string. Instead of hardcoding the data start
index in the test, we now use String::contains().

* UIProcess/API/efl/tests/test_ewk2_view.cpp:
(PageContentsCallback):
(TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (142152 => 142153)


--- trunk/Source/WebKit2/ChangeLog	2013-02-07 18:48:39 UTC (rev 142152)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-07 18:49:45 UTC (rev 142153)
@@ -1,3 +1,20 @@
+2013-02-07  Christophe Dumez  <[email protected]>
+
+        [EFL][WK2] EWK2UnitTestBase.ewk_view_page_contents_get API test is sometimes failing
+        https://bugs.webkit.org/show_bug.cgi?id=108634
+
+        Reviewed by Alexey Proskuryakov.
+
+        Use more robust data validation in EWK2UnitTestBase.ewk_view_page_contents_get
+        so that the test passes consistently. The issue was that the header before the
+        data includes the current date. Depending on the date, the data may start at a
+        different index in the returned string. Instead of hardcoding the data start
+        index in the test, we now use String::contains().
+
+        * UIProcess/API/efl/tests/test_ewk2_view.cpp:
+        (PageContentsCallback):
+        (TEST_F):
+
 2013-02-07  Gavin Peters  <[email protected]>
 
         Unreviewed, rolling out r142141.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp (142152 => 142153)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp	2013-02-07 18:48:39 UTC (rev 142152)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp	2013-02-07 18:49:45 UTC (rev 142153)
@@ -917,7 +917,7 @@
     evas_object_smart_callback_del(webView(), "contents,size,changed", onContentsSizeChanged);
 }
 
-static bool isObtainedPageContents = false;
+static bool obtainedPageContents = false;
 
 static void PageContentsCallback(Ewk_Page_Contents_Type type, const char* data)
 {
@@ -925,14 +925,15 @@
     ASSERT_EQ(EWK_PAGE_CONTENTS_TYPE_MHTML, type);
 
     // The variable data should have below text block.
-    const char lines[] = "<=00h=00t=00m=00l=00>=00<=00h=00e=00a=00d=00>=00<=00m=00e=00t=00a=00 =00c=\r\n"
+    const String expectedMHTML = "\r\n\r\n<=00h=00t=00m=00l=00>=00<=00h=00e=00a=00d=00>=00<=00m=00e=00t=00a=00 =00c=\r\n"
         "=00h=00a=00r=00s=00e=00t=00=3D=00\"=00U=00T=00F=00-=001=006=00L=00E=00\"=00>=\r\n"
         "=00<=00/=00h=00e=00a=00d=00>=00<=00b=00o=00d=00y=00>=00<=00p=00>=00S=00i=00=\r\n"
         "m=00p=00l=00e=00 =00H=00T=00M=00L=00<=00/=00p=00>=00<=00/=00b=00o=00d=00y=\r\n"
-        "=00>=00<=00/=00h=00t=00m=00l=00>=00";
-    ASSERT_EQ(0, strncmp(data + 359, lines, strlen(lines)));
+        "=00>=00<=00/=00h=00t=00m=00l=00>=00\r\n";
 
-    isObtainedPageContents = true;
+    ASSERT_TRUE(String(data).contains(expectedMHTML));
+
+    obtainedPageContents = true;
 }
 
 TEST_F(EWK2UnitTestBase, ewk_view_page_contents_get)
@@ -942,7 +943,7 @@
     waitUntilLoadFinished();
 
     ASSERT_TRUE(ewk_view_page_contents_get(webView(), EWK_PAGE_CONTENTS_TYPE_MHTML, PageContentsCallback));
-    while (!isObtainedPageContents)
+    while (!obtainedPageContents)
         ecore_main_loop_iterate();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to