OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdio.h> |
| 6 #if defined(OS_POSIX) |
| 7 #include <unistd.h> |
| 8 #elif defined(OS_WIN) |
| 9 #include <windows.h> |
| 10 #endif |
| 11 |
5 #include "chrome/test/nacl/nacl_browsertest_util.h" | 12 #include "chrome/test/nacl/nacl_browsertest_util.h" |
6 | 13 |
7 namespace { | 14 namespace { |
8 | 15 |
9 // These tests fail on Linux ASAN bots: <http://crbug.com/161709>. | 16 // These tests fail on Linux ASAN bots: <http://crbug.com/161709>. |
10 #if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) | 17 #if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) |
11 #define MAYBE_SimpleLoad DISABLED_SimpleLoad | 18 #define MAYBE_SimpleLoad DISABLED_SimpleLoad |
12 #define MAYBE_ExitStatus0 DISABLED_ExitStatus0 | 19 #define MAYBE_ExitStatus0 DISABLED_ExitStatus0 |
13 #define MAYBE_ExitStatus254 DISABLED_ExitStatus254 | 20 #define MAYBE_ExitStatus254 DISABLED_ExitStatus254 |
14 #define MAYBE_ExitStatusNeg2 DISABLED_ExitStatusNeg2 | 21 #define MAYBE_ExitStatusNeg2 DISABLED_ExitStatusNeg2 |
15 #define MAYBE_PPAPICore DISABLED_PPAPICore | 22 #define MAYBE_PPAPICore DISABLED_PPAPICore |
16 #define MAYBE_ProgressEvents DISABLED_ProgressEvents | 23 #define MAYBE_ProgressEvents DISABLED_ProgressEvents |
17 #define MAYBE_CrossOriginCORS DISABLED_CrossOriginCORS | 24 #define MAYBE_CrossOriginCORS DISABLED_CrossOriginCORS |
18 #define MAYBE_CrossOriginFail DISABLED_CrossOriginFail | 25 #define MAYBE_CrossOriginFail DISABLED_CrossOriginFail |
19 #define MAYBE_SameOriginCookie DISABLED_SameOriginCookie | 26 #define MAYBE_SameOriginCookie DISABLED_SameOriginCookie |
20 #define MAYBE_CORSNoCookie DISABLED_CORSNoCookie | 27 #define MAYBE_CORSNoCookie DISABLED_CORSNoCookie |
| 28 #define MAYBE_SysconfNprocessorsOnln DISABLED_SysconfNprocessorsOnln |
21 #else | 29 #else |
22 #define MAYBE_SimpleLoad SimpleLoad | 30 #define MAYBE_SimpleLoad SimpleLoad |
23 #define MAYBE_ExitStatus0 ExitStatus0 | 31 #define MAYBE_ExitStatus0 ExitStatus0 |
24 #define MAYBE_ExitStatus254 ExitStatus254 | 32 #define MAYBE_ExitStatus254 ExitStatus254 |
25 #define MAYBE_ExitStatusNeg2 ExitStatusNeg2 | 33 #define MAYBE_ExitStatusNeg2 ExitStatusNeg2 |
26 #define MAYBE_PPAPICore PPAPICore | 34 #define MAYBE_PPAPICore PPAPICore |
27 #define MAYBE_ProgressEvents ProgressEvents | 35 #define MAYBE_ProgressEvents ProgressEvents |
28 #define MAYBE_CrossOriginCORS CrossOriginCORS | 36 #define MAYBE_CrossOriginCORS CrossOriginCORS |
29 #define MAYBE_CrossOriginFail CrossOriginFail | 37 #define MAYBE_CrossOriginFail CrossOriginFail |
30 #define MAYBE_SameOriginCookie SameOriginCookie | 38 #define MAYBE_SameOriginCookie SameOriginCookie |
31 #define MAYBE_CORSNoCookie CORSNoCookie | 39 #define MAYBE_CORSNoCookie CORSNoCookie |
| 40 #define MAYBE_SysconfNprocessorsOnln SysconfNprocessorsOnln |
32 #endif | 41 #endif |
33 | 42 |
34 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SimpleLoad, { | 43 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SimpleLoad, { |
35 RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html")); | 44 RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html")); |
36 }) | 45 }) |
37 | 46 |
38 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatus0, { | 47 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatus0, { |
39 RunNaClIntegrationTest(FILE_PATH_LITERAL( | 48 RunNaClIntegrationTest(FILE_PATH_LITERAL( |
40 "pm_exit_status_test.html?trigger=exit0&expected_exit=0")); | 49 "pm_exit_status_test.html?trigger=exit0&expected_exit=0")); |
41 }) | 50 }) |
42 | 51 |
43 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatus254, { | 52 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatus254, { |
44 RunNaClIntegrationTest(FILE_PATH_LITERAL( | 53 RunNaClIntegrationTest(FILE_PATH_LITERAL( |
45 "pm_exit_status_test.html?trigger=exit254&expected_exit=254")); | 54 "pm_exit_status_test.html?trigger=exit254&expected_exit=254")); |
46 }) | 55 }) |
47 | 56 |
48 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatusNeg2, { | 57 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatusNeg2, { |
49 RunNaClIntegrationTest(FILE_PATH_LITERAL( | 58 RunNaClIntegrationTest(FILE_PATH_LITERAL( |
50 "pm_exit_status_test.html?trigger=exitneg2&expected_exit=254")); | 59 "pm_exit_status_test.html?trigger=exitneg2&expected_exit=254")); |
51 }) | 60 }) |
52 | 61 |
53 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_PPAPICore, { | 62 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_PPAPICore, { |
54 RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_ppb_core.html")); | 63 RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_ppb_core.html")); |
55 }) | 64 }) |
56 | 65 |
57 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ProgressEvents, { | 66 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ProgressEvents, { |
58 RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_progress_events.html")); | 67 RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_progress_events.html")); |
59 }) | 68 }) |
60 | 69 |
| 70 // Visual Studio does not like preprocessor conditionals inside the |
| 71 // argument of a macro, so we put the conditionals on a helper |
| 72 // function. We are already in an anonymous namespace, so the name of |
| 73 // the helper is not visible in external scope. |
| 74 // |
| 75 // The string buffer is sufficient sized: 2**64 < 8**22 < 10**22. |
| 76 #if defined(OS_POSIX) |
| 77 base::FilePath::StringType NumberOfCoresAsFilePathString() { |
| 78 char string_rep[23]; |
| 79 snprintf(string_rep, sizeof string_rep, "%ld", sysconf(_SC_NPROCESSORS_ONLN)); |
| 80 return string_rep; |
| 81 } |
| 82 #elif defined(OS_WIN) |
| 83 base::FilePath::StringType NumberOfCoresAsFilePathString() { |
| 84 wchar_t string_rep[23]; |
| 85 SYSTEM_INFO system_info; |
| 86 GetSystemInfo(&system_info); |
| 87 _snwprintf_s(string_rep, sizeof string_rep, _TRUNCATE, L"%u", |
| 88 system_info.dwNumberOfProcessors); |
| 89 return string_rep; |
| 90 } |
| 91 #endif |
| 92 |
| 93 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SysconfNprocessorsOnln, { |
| 94 base::FilePath::StringType path = |
| 95 FILE_PATH_LITERAL("sysconf_nprocessors_onln_test.html?cpu_count="); |
| 96 path = path + NumberOfCoresAsFilePathString(); |
| 97 RunNaClIntegrationTest(path); |
| 98 }) |
| 99 |
61 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginCORS) { | 100 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginCORS) { |
62 RunLoadTest(FILE_PATH_LITERAL("cross_origin/cors.html")); | 101 RunLoadTest(FILE_PATH_LITERAL("cross_origin/cors.html")); |
63 } | 102 } |
64 | 103 |
65 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginFail) { | 104 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginFail) { |
66 RunLoadTest(FILE_PATH_LITERAL("cross_origin/fail.html")); | 105 RunLoadTest(FILE_PATH_LITERAL("cross_origin/fail.html")); |
67 } | 106 } |
68 | 107 |
69 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_SameOriginCookie) { | 108 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_SameOriginCookie) { |
70 RunLoadTest(FILE_PATH_LITERAL("cross_origin/same_origin_cookie.html")); | 109 RunLoadTest(FILE_PATH_LITERAL("cross_origin/same_origin_cookie.html")); |
(...skipping 17 matching lines...) Expand all Loading... |
88 MAYBE_PNACL(PnaclNMFOptionsOlarge)) { | 127 MAYBE_PNACL(PnaclNMFOptionsOlarge)) { |
89 RunLoadTest(FILE_PATH_LITERAL("pnacl_options.html?use_nmf=o_large")); | 128 RunLoadTest(FILE_PATH_LITERAL("pnacl_options.html?use_nmf=o_large")); |
90 } | 129 } |
91 | 130 |
92 IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnacl, | 131 IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnacl, |
93 MAYBE_PNACL(PnaclNMFOptionsTimePasses)) { | 132 MAYBE_PNACL(PnaclNMFOptionsTimePasses)) { |
94 RunLoadTest(FILE_PATH_LITERAL("pnacl_options.html?use_nmf=time_passes")); | 133 RunLoadTest(FILE_PATH_LITERAL("pnacl_options.html?use_nmf=time_passes")); |
95 } | 134 } |
96 | 135 |
97 } // namespace anonymous | 136 } // namespace anonymous |
OLD | NEW |