gfx/2d/unittest/Main.cpp

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "SanityChecks.h"
     7 #include "TestPoint.h"
     8 #include "TestScaling.h"
     9 #include "TestBugs.h"
    10 #ifdef WIN32
    11 #include "TestDrawTargetD2D.h"
    12 #endif
    14 #include <string>
    15 #include <sstream>
    17 struct TestObject {
    18   TestBase *test;
    19   std::string name;
    20 };
    23 using namespace std;
    25 int
    26 main()
    27 {
    28   TestObject tests[] = 
    29   {
    30     { new SanityChecks(), "Sanity Checks" },
    31   #ifdef WIN32
    32     { new TestDrawTargetD2D(), "DrawTarget (D2D)" },
    33   #endif
    34     { new TestPoint(), "Point Tests" },
    35     { new TestScaling(), "Scaling Tests" }
    36     { new TestBugs(), "Bug Tests" }
    37   };
    39   int totalFailures = 0;
    40   int totalTests = 0;
    41   stringstream message;
    42   printf("------ STARTING RUNNING TESTS ------\n");
    43   for (int i = 0; i < sizeof(tests) / sizeof(TestObject); i++) {
    44     message << "--- RUNNING TESTS: " << tests[i].name << " ---\n";
    45     printf(message.str().c_str());
    46     message.str("");
    47     int failures = 0;
    48     totalTests += tests[i].test->RunTests(&failures);
    49     totalFailures += failures;
    50     // Done with this test!
    51     delete tests[i].test;
    52   }
    53   message << "------ FINISHED RUNNING TESTS ------\nTests run: " << totalTests << " - Passes: " << totalTests - totalFailures << " - Failures: " << totalFailures << "\n";
    54   printf(message.str().c_str());
    55   return totalFailures;
    56 }

mercurial