| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/public/tests/test_support_private.h" | 5 #include "mojo/public/tests/test_support_private.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| 11 static mojo::test::TestSupport* g_test_support = NULL; | 11 static mojo::test::TestSupport* g_test_support = NULL; |
| 12 | 12 |
| 13 extern "C" { | 13 extern "C" { |
| 14 | 14 |
| 15 void MojoTestSupportLogPerfResult(const char* test_name, | 15 void MojoTestSupportLogPerfResult(const char* test_name, |
| 16 const char* sub_test_name, |
| 16 double value, | 17 double value, |
| 17 const char* units) { | 18 const char* units) { |
| 18 if (g_test_support) | 19 if (g_test_support) { |
| 19 g_test_support->LogPerfResult(test_name, value, units); | 20 g_test_support->LogPerfResult(test_name, sub_test_name, value, units); |
| 20 else | 21 } else { |
| 21 printf("[no test runner]\t%s\t%g\t%s\n", test_name, value, units); | 22 if (sub_test_name) { |
| 23 printf("[no test runner]\t%s/%s\t%g\t%s\n", test_name, sub_test_name, |
| 24 value, units); |
| 25 } else { |
| 26 printf("[no test runner]\t%s\t%g\t%s\n", test_name, value, units); |
| 27 } |
| 28 } |
| 22 } | 29 } |
| 23 | 30 |
| 24 FILE* MojoTestSupportOpenSourceRootRelativeFile(const char* relative_path) { | 31 FILE* MojoTestSupportOpenSourceRootRelativeFile(const char* relative_path) { |
| 25 if (g_test_support) | 32 if (g_test_support) |
| 26 return g_test_support->OpenSourceRootRelativeFile(relative_path); | 33 return g_test_support->OpenSourceRootRelativeFile(relative_path); |
| 27 printf("[no test runner]\n"); | 34 printf("[no test runner]\n"); |
| 28 return NULL; | 35 return NULL; |
| 29 } | 36 } |
| 30 | 37 |
| 31 char** MojoTestSupportEnumerateSourceRootRelativeDirectory( | 38 char** MojoTestSupportEnumerateSourceRootRelativeDirectory( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 60 return g_test_support; | 67 return g_test_support; |
| 61 } | 68 } |
| 62 | 69 |
| 63 // static | 70 // static |
| 64 void TestSupport::Reset() { | 71 void TestSupport::Reset() { |
| 65 g_test_support = NULL; | 72 g_test_support = NULL; |
| 66 } | 73 } |
| 67 | 74 |
| 68 } // namespace test | 75 } // namespace test |
| 69 } // namespace mojo | 76 } // namespace mojo |
| OLD | NEW |