Index: chrome/test/nacl/nacl_browsertest.cc |
diff --git a/chrome/test/nacl/nacl_browsertest.cc b/chrome/test/nacl/nacl_browsertest.cc |
index 9336311d21664d7352a6c4da9046a2b8fabcf4c8..e62a10731762cca72bd6b842cce00821c4b24223 100644 |
--- a/chrome/test/nacl/nacl_browsertest.cc |
+++ b/chrome/test/nacl/nacl_browsertest.cc |
@@ -2,6 +2,13 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include <stdio.h> |
+#if defined(OS_POSIX) |
+#include <unistd.h> |
+#elif defined(OS_WIN) |
+#include <windows.h> |
+#endif |
+ |
#include "chrome/test/nacl/nacl_browsertest_util.h" |
namespace { |
@@ -58,6 +65,36 @@ NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ProgressEvents, { |
RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_progress_events.html")); |
}) |
+// Visual Studio does not like preprocessor conditionals inside the |
+// argument of a macro, so we put the conditionals on a helper |
+// function. We are already in an anonymous namespace, so the name of |
+// the helper is not visible in external scope. |
+// |
+// The string buffer is sufficient sized: 2**64 < 8**22 < 10**22. |
+#if defined(OS_POSIX) |
+base::FilePath::StringType NumberOfCoresAsFilePathString() { |
+ char string_rep[23]; |
+ snprintf(string_rep, sizeof string_rep, "%ld", sysconf(_SC_NPROCESSORS_ONLN)); |
+ return string_rep; |
+} |
+#elif defined(OS_WIN) |
+base::FilePath::StringType NumberOfCoresAsFilePathString() { |
+ wchar_t string_rep[23]; |
+ SYSTEM_INFO system_info; |
+ GetSystemInfo(&system_info); |
+ _snwprintf_s(string_rep, sizeof string_rep, _TRUNCATE, L"%u", |
+ system_info.dwNumberOfProcessors); |
+ return string_rep; |
+} |
+#endif |
+ |
+NACL_BROWSER_TEST_F(NaClBrowserTest, SysconfNprocessorsOnln, { |
jvoung (off chromium)
2013/04/17 17:07:18
You might not need to "MAYBE_${testname}", but I c
bsy
2013/04/17 20:55:21
Done.
|
+ base::FilePath::StringType path = |
+ FILE_PATH_LITERAL("sysconf_nprocessors_onln_test.html?cpu_count="); |
+ path = path + NumberOfCoresAsFilePathString(); |
+ RunNaClIntegrationTest(path); |
+}) |
+ |
IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginCORS) { |
RunLoadTest(FILE_PATH_LITERAL("cross_origin/cors.html")); |
} |