Skip Buffer OOM tests when using ASAN

ASAN throws when hitting OOM conditions which these tests intentionally
try to create.

Bug: dawn:450
Change-Id: I635480ae329cd5ace55287d77e2b79e663174f49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23246
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 3a14dbf..b71e84f 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -691,6 +691,14 @@
     return gTestEnv->IsSpvcParserBeingUsed();
 }
 
+bool DawnTestBase::IsAsan() const {
+#if defined(ADDRESS_SANITIZER)
+    return true;
+#else
+    return false;
+#endif
+}
+
 bool DawnTestBase::HasVendorIdFilter() const {
     return gTestEnv->HasVendorIdFilter();
 }
diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h
index 36e9e94..dddb9ad 100644
--- a/src/tests/DawnTest.h
+++ b/src/tests/DawnTest.h
@@ -250,6 +250,8 @@
     bool IsSpvcBeingUsed() const;
     bool IsSpvcParserBeingUsed() const;
 
+    bool IsAsan() const;
+
     void StartExpectDeviceError();
     bool EndExpectDeviceError();
 
diff --git a/src/tests/end2end/BufferTests.cpp b/src/tests/end2end/BufferTests.cpp
index e854c44..f29bacb 100644
--- a/src/tests/end2end/BufferTests.cpp
+++ b/src/tests/end2end/BufferTests.cpp
@@ -526,6 +526,7 @@
 TEST_P(BufferTests, CreateBufferOOM) {
     // TODO(http://crbug.com/dawn/27): Missing support.
     DAWN_SKIP_TEST_IF(IsOpenGL());
+    DAWN_SKIP_TEST_IF(IsAsan());
 
     wgpu::BufferDescriptor descriptor;
     descriptor.usage = wgpu::BufferUsage::CopyDst;
@@ -545,6 +546,7 @@
 TEST_P(BufferTests, CreateBufferMappedOOM) {
     // TODO(http://crbug.com/dawn/27): Missing support.
     DAWN_SKIP_TEST_IF(IsOpenGL());
+    DAWN_SKIP_TEST_IF(IsAsan());
 
     // Test non-mappable buffer
     {
@@ -592,6 +594,7 @@
 TEST_P(BufferTests, CreateBufferOOMMapReadAsync) {
     // TODO(http://crbug.com/dawn/27): Missing support.
     DAWN_SKIP_TEST_IF(IsOpenGL());
+    DAWN_SKIP_TEST_IF(IsAsan());
 
     auto RunTest = [this](const wgpu::BufferDescriptor& descriptor) {
         wgpu::Buffer buffer;
@@ -632,6 +635,7 @@
 TEST_P(BufferTests, CreateBufferOOMMapWriteAsync) {
     // TODO(http://crbug.com/dawn/27): Missing support.
     DAWN_SKIP_TEST_IF(IsOpenGL());
+    DAWN_SKIP_TEST_IF(IsAsan());
 
     auto RunTest = [this](const wgpu::BufferDescriptor& descriptor) {
         wgpu::Buffer buffer;