| 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 | |
| 12 #include "chrome/test/nacl/nacl_browsertest_util.h" | 5 #include "chrome/test/nacl/nacl_browsertest_util.h" |
| 13 | 6 |
| 14 namespace { | 7 namespace { |
| 15 | 8 |
| 16 // These tests fail on Linux ASAN bots: <http://crbug.com/161709>. | 9 // These tests fail on Linux ASAN bots: <http://crbug.com/161709>. |
| 17 #if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) | 10 #if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) |
| 18 #define MAYBE_SimpleLoad DISABLED_SimpleLoad | 11 #define MAYBE_SimpleLoad DISABLED_SimpleLoad |
| 19 #define MAYBE_ExitStatus0 DISABLED_ExitStatus0 | 12 #define MAYBE_ExitStatus0 DISABLED_ExitStatus0 |
| 20 #define MAYBE_ExitStatus254 DISABLED_ExitStatus254 | 13 #define MAYBE_ExitStatus254 DISABLED_ExitStatus254 |
| 21 #define MAYBE_ExitStatusNeg2 DISABLED_ExitStatusNeg2 | 14 #define MAYBE_ExitStatusNeg2 DISABLED_ExitStatusNeg2 |
| 22 #define MAYBE_PPAPICore DISABLED_PPAPICore | 15 #define MAYBE_PPAPICore DISABLED_PPAPICore |
| 23 #define MAYBE_ProgressEvents DISABLED_ProgressEvents | 16 #define MAYBE_ProgressEvents DISABLED_ProgressEvents |
| 24 #define MAYBE_CrossOriginCORS DISABLED_CrossOriginCORS | 17 #define MAYBE_CrossOriginCORS DISABLED_CrossOriginCORS |
| 25 #define MAYBE_CrossOriginFail DISABLED_CrossOriginFail | 18 #define MAYBE_CrossOriginFail DISABLED_CrossOriginFail |
| 26 #define MAYBE_SameOriginCookie DISABLED_SameOriginCookie | 19 #define MAYBE_SameOriginCookie DISABLED_SameOriginCookie |
| 27 #define MAYBE_CORSNoCookie DISABLED_CORSNoCookie | 20 #define MAYBE_CORSNoCookie DISABLED_CORSNoCookie |
| 28 #define MAYBE_SysconfNprocessorsOnln DISABLED_SysconfNprocessorsOnln | |
| 29 #else | 21 #else |
| 30 #define MAYBE_SimpleLoad SimpleLoad | 22 #define MAYBE_SimpleLoad SimpleLoad |
| 31 #define MAYBE_ExitStatus0 ExitStatus0 | 23 #define MAYBE_ExitStatus0 ExitStatus0 |
| 32 #define MAYBE_ExitStatus254 ExitStatus254 | 24 #define MAYBE_ExitStatus254 ExitStatus254 |
| 33 #define MAYBE_ExitStatusNeg2 ExitStatusNeg2 | 25 #define MAYBE_ExitStatusNeg2 ExitStatusNeg2 |
| 34 #define MAYBE_PPAPICore PPAPICore | 26 #define MAYBE_PPAPICore PPAPICore |
| 35 #define MAYBE_ProgressEvents ProgressEvents | 27 #define MAYBE_ProgressEvents ProgressEvents |
| 36 #define MAYBE_CrossOriginCORS CrossOriginCORS | 28 #define MAYBE_CrossOriginCORS CrossOriginCORS |
| 37 #define MAYBE_CrossOriginFail CrossOriginFail | 29 #define MAYBE_CrossOriginFail CrossOriginFail |
| 38 #define MAYBE_SameOriginCookie SameOriginCookie | 30 #define MAYBE_SameOriginCookie SameOriginCookie |
| 39 #define MAYBE_CORSNoCookie CORSNoCookie | 31 #define MAYBE_CORSNoCookie CORSNoCookie |
| 40 #define MAYBE_SysconfNprocessorsOnln SysconfNprocessorsOnln | |
| 41 #endif | 32 #endif |
| 42 | 33 |
| 43 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SimpleLoad, { | 34 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_SimpleLoad, { |
| 44 RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html")); | 35 RunLoadTest(FILE_PATH_LITERAL("nacl_load_test.html")); |
| 45 }) | 36 }) |
| 46 | 37 |
| 47 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatus0, { | 38 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatus0, { |
| 48 RunNaClIntegrationTest(FILE_PATH_LITERAL( | 39 RunNaClIntegrationTest(FILE_PATH_LITERAL( |
| 49 "pm_exit_status_test.html?trigger=exit0&expected_exit=0")); | 40 "pm_exit_status_test.html?trigger=exit0&expected_exit=0")); |
| 50 }) | 41 }) |
| 51 | 42 |
| 52 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatus254, { | 43 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatus254, { |
| 53 RunNaClIntegrationTest(FILE_PATH_LITERAL( | 44 RunNaClIntegrationTest(FILE_PATH_LITERAL( |
| 54 "pm_exit_status_test.html?trigger=exit254&expected_exit=254")); | 45 "pm_exit_status_test.html?trigger=exit254&expected_exit=254")); |
| 55 }) | 46 }) |
| 56 | 47 |
| 57 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatusNeg2, { | 48 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ExitStatusNeg2, { |
| 58 RunNaClIntegrationTest(FILE_PATH_LITERAL( | 49 RunNaClIntegrationTest(FILE_PATH_LITERAL( |
| 59 "pm_exit_status_test.html?trigger=exitneg2&expected_exit=254")); | 50 "pm_exit_status_test.html?trigger=exitneg2&expected_exit=254")); |
| 60 }) | 51 }) |
| 61 | 52 |
| 62 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_PPAPICore, { | 53 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_PPAPICore, { |
| 63 RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_ppb_core.html")); | 54 RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_ppb_core.html")); |
| 64 }) | 55 }) |
| 65 | 56 |
| 66 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ProgressEvents, { | 57 NACL_BROWSER_TEST_F(NaClBrowserTest, MAYBE_ProgressEvents, { |
| 67 RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_progress_events.html")); | 58 RunNaClIntegrationTest(FILE_PATH_LITERAL("ppapi_progress_events.html")); |
| 68 }) | 59 }) |
| 69 | 60 |
| 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 | |
| 100 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginCORS) { | 61 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginCORS) { |
| 101 RunLoadTest(FILE_PATH_LITERAL("cross_origin/cors.html")); | 62 RunLoadTest(FILE_PATH_LITERAL("cross_origin/cors.html")); |
| 102 } | 63 } |
| 103 | 64 |
| 104 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginFail) { | 65 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_CrossOriginFail) { |
| 105 RunLoadTest(FILE_PATH_LITERAL("cross_origin/fail.html")); | 66 RunLoadTest(FILE_PATH_LITERAL("cross_origin/fail.html")); |
| 106 } | 67 } |
| 107 | 68 |
| 108 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_SameOriginCookie) { | 69 IN_PROC_BROWSER_TEST_F(NaClBrowserTestStatic, MAYBE_SameOriginCookie) { |
| 109 RunLoadTest(FILE_PATH_LITERAL("cross_origin/same_origin_cookie.html")); | 70 RunLoadTest(FILE_PATH_LITERAL("cross_origin/same_origin_cookie.html")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 127 MAYBE_PNACL(PnaclNMFOptionsOlarge)) { | 88 MAYBE_PNACL(PnaclNMFOptionsOlarge)) { |
| 128 RunLoadTest(FILE_PATH_LITERAL("pnacl_options.html?use_nmf=o_large")); | 89 RunLoadTest(FILE_PATH_LITERAL("pnacl_options.html?use_nmf=o_large")); |
| 129 } | 90 } |
| 130 | 91 |
| 131 IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnacl, | 92 IN_PROC_BROWSER_TEST_F(NaClBrowserTestPnacl, |
| 132 MAYBE_PNACL(PnaclNMFOptionsTimePasses)) { | 93 MAYBE_PNACL(PnaclNMFOptionsTimePasses)) { |
| 133 RunLoadTest(FILE_PATH_LITERAL("pnacl_options.html?use_nmf=time_passes")); | 94 RunLoadTest(FILE_PATH_LITERAL("pnacl_options.html?use_nmf=time_passes")); |
| 134 } | 95 } |
| 135 | 96 |
| 136 } // namespace anonymous | 97 } // namespace anonymous |
| OLD | NEW |