diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-19 23:36:22 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-19 23:36:22 +0000 |
commit | 76aa16e46dae43c3ebb9c9b2818e7d25e5b34806 (patch) | |
tree | 29007161ec33f2d0aeccd9712c53c7f35bf22bab /ppapi/tests/testing_instance.h | |
parent | ddf6f55c37ef48e717803e059b8e836fefd1d418 (diff) | |
download | chromium_src-76aa16e46dae43c3ebb9c9b2818e7d25e5b34806.zip chromium_src-76aa16e46dae43c3ebb9c9b2818e7d25e5b34806.tar.gz chromium_src-76aa16e46dae43c3ebb9c9b2818e7d25e5b34806.tar.bz2 |
PPAPI/NaCl: Make related tests run in 1 fixture
I've only converted WebSockets tests in this CL. The idea is that the bulk of the test time is actually from starting up the test:
- Starting HTTP and/or WebSocket and/or SSL server
- Launching the renderer
- Launching the NaCl loader
- Downloading, validating, launching the .nexe
Now this all happens once for all WebSocket sub-tests (times 4: in-process, out-of-process, NaCl Newlib, NaCl Glibc). Locally, the time goes from about 5 minutes to less than 20 seconds.
The trick is now we can still enable/disable the individual tests from within ppapi_browsertest.cc.
BUG=
Review URL: https://chromiumcodereview.appspot.com/12193015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183319 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests/testing_instance.h')
-rw-r--r-- | ppapi/tests/testing_instance.h | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/ppapi/tests/testing_instance.h b/ppapi/tests/testing_instance.h index 2ce6c4b..a523137 100644 --- a/ppapi/tests/testing_instance.h +++ b/ppapi/tests/testing_instance.h @@ -62,12 +62,17 @@ pp::InstancePrivate { // Outputs the information from one test run, using the format // <test_name> [PASS|FAIL <error_message>] + // + // You should generally use one of the RUN_TEST* macros in test_case.h + // instead. + // // If error_message is empty, we say the test passed and emit PASS. If // error_message is nonempty, the test failed with that message as the error // string. // // Intended usage: - // LogTest("Foo", FooTest()); + // PP_TimeTicks start_time(core.GetTimeTicks()); + // LogTest("Foo", FooTest(), start_time); // // Where FooTest is defined as: // std::string FooTest() { @@ -75,7 +80,13 @@ pp::InstancePrivate { // return "Something horrible happened"; // return ""; // } - void LogTest(const std::string& test_name, const std::string& error_message); + // + // NOTE: It's important to get the start time in the previous line, rather + // than calling GetTimeTicks in the LogTestLine. There's no guarantee + // that GetTimeTicks will be evaluated before FooTest(). + void LogTest(const std::string& test_name, + const std::string& error_message, + PP_TimeTicks start_time); // Appends an error message to the log. void AppendError(const std::string& message); @@ -116,15 +127,6 @@ pp::InstancePrivate { // test. Ownership is passed to the caller. The given string is split by '_'. // The test case name is the first part. TestCase* CaseForTestName(const std::string& name); - // Returns the filter (second part) of the given string. If there is no '_', - // returns the empty string, which means 'run all tests for this test case'. - // E.g.: - // http://testserver/test_case.html?testcase=PostMessage - // Otherwise, the part of the testcase after '_' is returned, and the test - // whose name matches that string (if any) will be run: - // http://testserver/test_case.html?testcase=PostMessage_SendingData - // Runs 'PostMessage_SendingData. - std::string FilterForTestName(const std::string& name); // Sends a test command to the page using PostMessage. void SendTestCommand(const std::string& command); |