Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: chrome/test/nacl/nacl_browsertest.cc

Issue 14238013: Set up NaClChromeMainArgs number_of_cores member so apps can size threadpools appropriately (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR fb Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/nacl/sysconf_nprocessors_onln/sysconf_nprocessors_onln_test.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3e34870b67eb175679d729c8fafb2cca824aab99 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 {
@@ -18,6 +25,7 @@ namespace {
#define MAYBE_CrossOriginFail DISABLED_CrossOriginFail
#define MAYBE_SameOriginCookie DISABLED_SameOriginCookie
#define MAYBE_CORSNoCookie DISABLED_CORSNoCookie
+#define MAYBE_SysconfNprocessorsOnln DISABLED_SysconfNprocessorsOnln
#else
#define MAYBE_SimpleLoad SimpleLoad
#define MAYBE_ExitStatus0 ExitStatus0
@@ -29,6 +37,7 @@ namespace {
#define MAYBE_CrossOriginFail CrossOriginFail
#define MAYBE_SameOriginCookie SameOriginCookie
#define MAYBE_CORSNoCookie CORSNoCookie
+#define MAYBE_SysconfNprocessorsOnln SysconfNprocessorsOnln
#endif
NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SimpleLoad, {
@@ -58,6 +67,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, MAYBE_SysconfNprocessorsOnln, {
+ 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"));
}
« no previous file with comments | « chrome/test/data/nacl/sysconf_nprocessors_onln/sysconf_nprocessors_onln_test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698