Closed Bug 1314827 Opened 3 years ago Closed 3 years ago

gtestify dom/base/test/*.cpp

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: njn, Assigned: njn)

References

Details

Attachments

(1 file)

The three .cpp unit tests in dom/base/test/ need to be converted to gtests for bug 1313141.
Please note the "njn:" comment in TestGetURL.cpp -- this test was broken and
needs fixing...
Attachment #8806962 - Flags: review?(amarchesini)
Comment on attachment 8806962 [details] [diff] [review]
gtestify dom/base/test/*.cpp

Review of attachment 8806962 [details] [diff] [review]:
-----------------------------------------------------------------

Cool! But don't loose the error messages.

::: dom/base/test/gtest/TestGetURL.cpp
@@ +15,5 @@
> +TEST(GetURL, Test)
> +{
> +  // njn: prior to this change this test did nothing because it was invoked
> +  // with no argument, and so just aborted with a usage message. What would be
> +  // an appropriate URL to use here? Or should this test just be removed?

Get rid of this test.

::: dom/base/test/gtest/TestNativeXMLHttpRequest.cpp
@@ +20,5 @@
>    nsresult rv;
>  
>    nsCOMPtr<nsIXMLHttpRequest> xhr =
>      do_CreateInstance(NS_XMLHTTPREQUEST_CONTRACTID, &rv);
> +  ASSERT_TRUE(NS_SUCCEEDED(rv));

You can do:

ASSERT_TRUE(NS_SUCCEDED(rv)) << "Couldn't create nsIXMLHttpRequest instance!";

@@ +28,5 @@
>    const nsAString& empty = EmptyString();
>  
>    nsCOMPtr<nsIScriptSecurityManager> secman =
>      do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
> +  ASSERT_TRUE(NS_SUCCEEDED(rv));

Same for all these.

::: dom/base/test/gtest/TestPlainTextSerializer.cpp
@@ +41,5 @@
>    result.AssignLiteral("Firefox Firefox Firefox Firefox "
>                         "Firefox Firefox Firefox Firefox "
>                         "Firefox  \r\nFirefox Firefox Firefox\r\n");
>  
> +  ASSERT_TRUE(test.Equals(result));

error message here and in the other asserts.
Attachment #8806962 - Flags: review?(amarchesini) → review+
Backout by philringnalda@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c9308740eeb7
Backed out changeset 14d7b6dbe0fb to be able to back out something else
Pushed by nnethercote@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/81c8a80250c8
(attempt 2) - gtestify dom/base/test/*.cpp. r=baku.
https://hg.mozilla.org/mozilla-central/rev/81c8a80250c8
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.