Multi-string shaders

BUG=skia:

Committed: https://skia.googlesource.com/skia/+/1c3c2d83364ee228e0751df0e1b9c161c0ba8c1e

Review URL: https://codereview.chromium.org/929503002
diff --git a/tests/GrGLSLPrettyPrintTest.cpp b/tests/GrGLSLPrettyPrintTest.cpp
index 9977488..827a27b 100644
--- a/tests/GrGLSLPrettyPrintTest.cpp
+++ b/tests/GrGLSLPrettyPrintTest.cpp
@@ -13,12 +13,16 @@
 
 const SkString input1("#this is not a realshader\nvec4 some stuff;outside of a function;"
                      "int i(int b, int c) { { some stuff;} fake block; //comments\n return i;}"
-                     "void main()"
-                     "{nowin a function;{indenting;{abit more;dreadedfor((;;)(;)((;;);)){doingstuff"
+                     "void main()");
+const SkString input2("{nowin a function;{indenting;{abit more;dreadedfor((;;)(;)((;;);)){"
+                     "doingstuff"
                      ";for(;;;){and more stufff;mixed garbage\n\n\t\t\t\t\n/*using this"
-                     " comment\n is"
-                     " dangerous\ndo so at your own\n risk*/;\n\n\t\t\t\n"
-                     "//a comment\n}}a; little ;  love; for   ; leading;  spaces;} "
+                     " comment\n is");
+const SkString input3(" dangerous\ndo so at your own\n risk*/;\n\n\t\t\t\n"
+                     "//a comment");
+const SkString input4("breaking in comment");
+const SkString input5("continuing the comment");
+const SkString input6("\n}}a; little ;  love; for   ; leading;  spaces;} "
                      "an struct = { int a; int b; };"
                      "int[5] arr = int[5](1,2,3,4,5);} some code at the bottom; for(;;) {} }");
 
@@ -52,7 +56,7 @@
         "  27\t\t\t\t\t\t is dangerous\n"
         "  28\t\t\t\t\t\tdo so at your own\n"
         "  29\t\t\t\t\t\t risk*/;\n"
-        "  30\t\t\t\t\t\t//a comment\n"
+        "  30\t\t\t\t\t\t//a commentbreaking in commentcontinuing the comment\n"
         "  31\t\t\t\t\t}\n"
         "  32\t\t\t\t}\n"
         "  33\t\t\t\ta;\n"
@@ -77,16 +81,43 @@
         "  52\t}\n"
         "  53\t");
 
-const SkString input2("{;;{{{{;;;{{{{{{{{{{{###\n##\n#####(((((((((((((unbalanced verything;;;"
-        "}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
+const SkString neg1("{;;{{{{;;;{{{{{{{{{{{");
+const SkString neg2("###\n##\n#####(((((((((((((unbalanced verything;;;");
+const SkString neg3("}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}"
         ";;;;;;/////");
 
 DEF_TEST(GrGLSLPrettyPrint, r) {
-    SkString test = GrGLSLPrettyPrint::PrettyPrintGLSL(input1, true);
+    SkTArray<const char*> testStr;
+    SkTArray<int> lengths;
+    testStr.push_back(input1.c_str());
+    lengths.push_back((int)input1.size());
+    testStr.push_back(input2.c_str());
+    lengths.push_back((int)input2.size());
+    testStr.push_back(input3.c_str());
+    lengths.push_back((int)input3.size());
+    testStr.push_back(input4.c_str());
+    lengths.push_back((int)input4.size());
+    testStr.push_back(input5.c_str());
+    lengths.push_back((int)input5.size());
+    testStr.push_back(input6.c_str());
+    lengths.push_back((int)input6.size());
+
+    SkString test = GrGLSLPrettyPrint::PrettyPrintGLSL(testStr.begin(), lengths.begin(),
+                                                       testStr.count(), true);
     ASSERT(output1 == test);
 
+    testStr.reset();
+    lengths.reset();
+    testStr.push_back(neg1.c_str());
+    lengths.push_back((int)neg1.size());
+    testStr.push_back(neg2.c_str());
+    lengths.push_back((int)neg2.size());
+    testStr.push_back(neg3.c_str());
+    lengths.push_back((int)neg3.size());
+
     // Just test we don't crash with garbage input
-    ASSERT(GrGLSLPrettyPrint::PrettyPrintGLSL(input2, true).c_str() != NULL);
+    ASSERT(GrGLSLPrettyPrint::PrettyPrintGLSL(testStr.begin(), lengths.begin(), 1,
+                                              true).c_str() != NULL);
 }
 
 #endif