aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/StringTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/StringTest.cpp')
-rw-r--r--tests/StringTest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 8ae7412187..91ef009edd 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -8,6 +8,7 @@
#include <stdarg.h>
#include <stdio.h>
#include "SkString.h"
+#include "SkThreadUtils.h"
#include "Test.h"
// Windows vsnprintf doesn't 0-terminate safely), but is so far
@@ -287,3 +288,26 @@ DEF_TEST(String_SkStrSplit_All, r) {
REPORTER_ASSERT(r, results[2].equals("b"));
REPORTER_ASSERT(r, results[3].equals(""));
}
+
+// https://bugs.chromium.org/p/skia/issues/detail?id=7107
+DEF_TEST(String_Threaded, r) {
+ SkString gString("foo");
+ SkThread::entryPointProc readString = [](void* context) -> void {
+ SkString gStringCopy = *reinterpret_cast<SkString*>(context);
+ bool equals_string = gStringCopy.equals("test");
+ (void)equals_string;
+ };
+ SkThread threads[] = {
+ {readString, &gString},
+ {readString, &gString},
+ {readString, &gString},
+ {readString, &gString},
+ {readString, &gString},
+ };
+ for (SkThread& thread : threads) {
+ thread.start();
+ }
+ for (SkThread& thread : threads) {
+ thread.join();
+ }
+}