Enable (and fix) the DeviceLost tests on Metal

They were failing because services of the Metal backend like the
MapRequestTracker thought that work was still pending since the device
only waited for previous commands to complete, and not also pending
commands.

Bug: dawn:68
Change-Id: I917ecefe90707b0c89f7e9b4b7379a98ed3956d7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17320
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
diff --git a/src/dawn_native/metal/DeviceMTL.mm b/src/dawn_native/metal/DeviceMTL.mm
index f91fd95..c3d2faf 100644
--- a/src/dawn_native/metal/DeviceMTL.mm
+++ b/src/dawn_native/metal/DeviceMTL.mm
@@ -298,7 +298,12 @@
         while (GetCompletedCommandSerial() != mLastSubmittedSerial) {
             usleep(100);
         }
-        Tick();
+
+        // Artificially increase the serials so work that was pending knows it can complete.
+        mCompletedSerial++;
+        mLastSubmittedSerial++;
+
+        DAWN_TRY(TickImpl());
         return {};
     }
 
diff --git a/src/tests/end2end/DeviceLostTests.cpp b/src/tests/end2end/DeviceLostTests.cpp
index b06377c..410a5c6 100644
--- a/src/tests/end2end/DeviceLostTests.cpp
+++ b/src/tests/end2end/DeviceLostTests.cpp
@@ -471,4 +471,4 @@
     device.LoseForTesting();
 }
 
-DAWN_INSTANTIATE_TEST(DeviceLostTest, D3D12Backend(), VulkanBackend());
+DAWN_INSTANTIATE_TEST(DeviceLostTest, D3D12Backend(), MetalBackend(), VulkanBackend());