| 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 #ifndef MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_ | 5 #ifndef MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_ |
| 6 #define MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_ | 6 #define MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_ |
| 7 | 7 |
| 8 // Note: This header should be compilable as C. | 8 // Note: This header should be compilable as C. |
| 9 | 9 |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| 11 | 11 |
| 12 #include "mojo/public/c/test_support/test_support_export.h" |
| 13 |
| 12 #ifdef __cplusplus | 14 #ifdef __cplusplus |
| 13 extern "C" { | 15 extern "C" { |
| 14 #endif | 16 #endif |
| 15 | 17 |
| 16 // |sub_test_name| is optional. If not null, it usually describes one particular | 18 // |sub_test_name| is optional. If not null, it usually describes one particular |
| 17 // configuration of the test. For example, if |test_name| is "TestPacketRate", | 19 // configuration of the test. For example, if |test_name| is "TestPacketRate", |
| 18 // |sub_test_name| could be "100BytesPerPacket". | 20 // |sub_test_name| could be "100BytesPerPacket". |
| 19 // When the perf data is visualized by the performance dashboard, data with | 21 // When the perf data is visualized by the performance dashboard, data with |
| 20 // different |sub_test_name|s (but the same |test_name|) are depicted as | 22 // different |sub_test_name|s (but the same |test_name|) are depicted as |
| 21 // different traces on the same chart. | 23 // different traces on the same chart. |
| 22 void MojoTestSupportLogPerfResult( | 24 MOJO_TEST_SUPPORT_EXPORT void MojoTestSupportLogPerfResult( |
| 23 const char* test_name, | 25 const char* test_name, |
| 24 const char* sub_test_name, | 26 const char* sub_test_name, |
| 25 double value, | 27 double value, |
| 26 const char* units); | 28 const char* units); |
| 27 | 29 |
| 28 // Opens a "/"-delimited file path relative to the source root. | 30 // Opens a "/"-delimited file path relative to the source root. |
| 29 FILE* MojoTestSupportOpenSourceRootRelativeFile( | 31 MOJO_TEST_SUPPORT_EXPORT FILE* MojoTestSupportOpenSourceRootRelativeFile( |
| 30 const char* source_root_relative_path); | 32 const char* source_root_relative_path); |
| 31 | 33 |
| 32 // Enumerates a "/"-delimited directory path relative to the source root. | 34 // Enumerates a "/"-delimited directory path relative to the source root. |
| 33 // Returns only regular files. The return value is a heap-allocated array of | 35 // Returns only regular files. The return value is a heap-allocated array of |
| 34 // heap-allocated strings. Each must be free'd separately. | 36 // heap-allocated strings. Each must be free'd separately. |
| 35 // | 37 // |
| 36 // The return value is built like so: | 38 // The return value is built like so: |
| 37 // | 39 // |
| 38 // char** rv = (char**) calloc(N + 1, sizeof(char*)); | 40 // char** rv = (char**) calloc(N + 1, sizeof(char*)); |
| 39 // rv[0] = strdup("a"); | 41 // rv[0] = strdup("a"); |
| 40 // rv[1] = strdup("b"); | 42 // rv[1] = strdup("b"); |
| 41 // rv[2] = strdup("c"); | 43 // rv[2] = strdup("c"); |
| 42 // ... | 44 // ... |
| 43 // rv[N] = NULL; | 45 // rv[N] = NULL; |
| 44 // | 46 // |
| 47 MOJO_TEST_SUPPORT_EXPORT |
| 45 char** MojoTestSupportEnumerateSourceRootRelativeDirectory( | 48 char** MojoTestSupportEnumerateSourceRootRelativeDirectory( |
| 46 const char* source_root_relative_path); | 49 const char* source_root_relative_path); |
| 47 | 50 |
| 48 #ifdef __cplusplus | 51 #ifdef __cplusplus |
| 49 } // extern "C" | 52 } // extern "C" |
| 50 #endif | 53 #endif |
| 51 | 54 |
| 52 #endif // MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_ | 55 #endif // MOJO_PUBLIC_C_TEST_SUPPORT_TEST_SUPPORT_H_ |
| OLD | NEW |