Make the complexity of the square generator configurable.

This adds and extra param to SquareGenerator's constructor that sets the number of squares used. By default, it uses the same value that was previously hard-coded.

Bug: webrtc:8326
Change-Id: Ie7cff94e4a54fd5bb91f981930cad5e624e0e132
Reviewed-on: https://webrtc-review.googlesource.com/6020
Commit-Queue: Erik Varga <erikvarga@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20223}
diff --git a/test/frame_generator.cc b/test/frame_generator.cc
index d2d580a..eb5e5d6 100644
--- a/test/frame_generator.cc
+++ b/test/frame_generator.cc
@@ -28,14 +28,14 @@
 namespace test {
 namespace {
 
-// SquareGenerator is a FrameGenerator that draws 10 randomly sized and colored
-// squares. Between each new generated frame, the squares are moved slightly
-// towards the lower right corner.
+// SquareGenerator is a FrameGenerator that draws a given amount of randomly
+// sized and colored squares. Between each new generated frame, the squares
+// are moved slightly towards the lower right corner.
 class SquareGenerator : public FrameGenerator {
  public:
-  SquareGenerator(int width, int height) {
+  SquareGenerator(int width, int height, int num_squares) {
     ChangeResolution(width, height);
-    for (int i = 0; i < 10; ++i) {
+    for (int i = 0; i < num_squares; ++i) {
       squares_.emplace_back(new Square(width, height, i + 1));
     }
   }
@@ -397,7 +397,14 @@
 std::unique_ptr<FrameGenerator> FrameGenerator::CreateSquareGenerator(
     int width,
     int height) {
-  return std::unique_ptr<FrameGenerator>(new SquareGenerator(width, height));
+  return std::unique_ptr<FrameGenerator>(
+      new SquareGenerator(width, height, 10));
+}
+
+std::unique_ptr<FrameGenerator>
+FrameGenerator::CreateSquareGenerator(int width, int height, int num_squares) {
+  return std::unique_ptr<FrameGenerator>(
+      new SquareGenerator(width, height, num_squares));
 }
 
 std::unique_ptr<FrameGenerator> FrameGenerator::CreateSlideGenerator(