| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/test/nacl/nacl_test.h" | 5 #include "chrome/test/nacl/nacl_test.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
| 11 #include "native_client/src/trusted/platform_qualify/nacl_os_qualify.h" |
| 11 #include "net/base/escape.h" | 12 #include "net/base/escape.h" |
| 12 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 const int kNaClTestTimeout = 20000; | 17 const int kNaClTestTimeout = 20000; |
| 17 const char kTestCompleteCookie[] = "status"; | 18 const char kTestCompleteCookie[] = "status"; |
| 18 const char kTestCompleteSuccess[] = "OK"; | 19 const char kTestCompleteSuccess[] = "OK"; |
| 19 | 20 |
| 20 const FilePath::CharType kBaseUrl[] = | 21 const FilePath::CharType kBaseUrl[] = |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 FILE_PATH_LITERAL("server_test.html"); | 53 FILE_PATH_LITERAL("server_test.html"); |
| 53 | 54 |
| 54 } // anonymous namespace | 55 } // anonymous namespace |
| 55 | 56 |
| 56 NaClTest::NaClTest() | 57 NaClTest::NaClTest() |
| 57 : UITest() { | 58 : UITest() { |
| 58 launch_arguments_.AppendSwitch(switches::kInternalNaCl); | 59 launch_arguments_.AppendSwitch(switches::kInternalNaCl); |
| 59 #if defined(OS_MACOSX) | 60 #if defined(OS_MACOSX) |
| 60 launch_arguments_.AppendSwitch(switches::kNoSandbox); | 61 launch_arguments_.AppendSwitch(switches::kNoSandbox); |
| 61 #endif | 62 #endif |
| 63 |
| 64 #if defined(OS_WIN) |
| 65 if (NaClOsIs64BitWindows()) |
| 66 launch_arguments_.AppendSwitch(switches::kNoSandbox); |
| 67 #endif |
| 62 } | 68 } |
| 63 | 69 |
| 64 NaClTest::~NaClTest() {} | 70 NaClTest::~NaClTest() {} |
| 65 | 71 |
| 66 FilePath NaClTest::GetTestRootDir() { | 72 FilePath NaClTest::GetTestRootDir() { |
| 67 FilePath path; | 73 FilePath path; |
| 68 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 74 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 69 path = path.AppendASCII("native_client"); | 75 path = path.AppendASCII("native_client"); |
| 70 path = path.AppendASCII("tests"); | 76 path = path.AppendASCII("tests"); |
| 71 return path; | 77 return path; |
| 72 } | 78 } |
| 73 | 79 |
| 74 FilePath NaClTest::GetTestBinariesDir() { | 80 FilePath NaClTest::GetTestBinariesDir() { |
| 75 FilePath path = GetTestRootDir(); | 81 FilePath path = GetTestRootDir(); |
| 76 path = path.AppendASCII("prebuilt"); | 82 path = path.AppendASCII("prebuilt"); |
| 77 path = path.AppendASCII("x86"); | 83 bool use_x64_nexes = false; |
| 84 #if defined(OS_WIN) |
| 85 if (NaClOsIs64BitWindows()) |
| 86 use_x64_nexes = true; |
| 87 #endif |
| 88 |
| 89 if (use_x64_nexes) |
| 90 path = path.AppendASCII("x64"); |
| 91 else |
| 92 path = path.AppendASCII("x86"); |
| 78 return path; | 93 return path; |
| 79 } | 94 } |
| 80 | 95 |
| 81 // static | 96 // static |
| 82 GURL NaClTest::GetTestUrl(const FilePath& filename) { | 97 GURL NaClTest::GetTestUrl(const FilePath& filename) { |
| 83 FilePath path(kBaseUrl); | 98 FilePath path(kBaseUrl); |
| 84 path = path.Append(filename); | 99 path = path.Append(filename); |
| 85 return GURL(path.value()); | 100 return GURL(path.value()); |
| 86 } | 101 } |
| 87 | 102 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 void NaClTest::TearDown() { | 249 void NaClTest::TearDown() { |
| 235 StopHttpServer(); | 250 StopHttpServer(); |
| 236 UITest::TearDown(); | 251 UITest::TearDown(); |
| 237 } | 252 } |
| 238 | 253 |
| 239 int NaClTest::NaClTestTimeout() { | 254 int NaClTest::NaClTestTimeout() { |
| 240 return std::max(kNaClTestTimeout, action_max_timeout_ms()); | 255 return std::max(kNaClTestTimeout, action_max_timeout_ms()); |
| 241 } | 256 } |
| 242 | 257 |
| 243 #if defined(OS_MACOSX) | 258 #if defined(OS_MACOSX) |
| 259 // http://code.google.com/p/nativeclient/issues/detail?id=342 |
| 244 TEST_F(NaClTest, FLAKY_ServerTest) { | 260 TEST_F(NaClTest, FLAKY_ServerTest) { |
| 245 #else | 261 #else |
| 246 TEST_F(NaClTest, ServerTest) { | 262 TEST_F(NaClTest, ServerTest) { |
| 247 #endif | 263 #endif |
| 248 FilePath test_file(kServerHtmlFileName); | 264 FilePath test_file(kServerHtmlFileName); |
| 249 RunTest(test_file, NaClTestTimeout()); | 265 RunTest(test_file, NaClTestTimeout()); |
| 250 } | 266 } |
| 251 | 267 |
| 252 #if defined(OS_MACOSX) | 268 #if defined(OS_MACOSX) |
| 269 // http://code.google.com/p/nativeclient/issues/detail?id=342 |
| 253 TEST_F(NaClTest, FLAKY_SrpcHelloWorld) { | 270 TEST_F(NaClTest, FLAKY_SrpcHelloWorld) { |
| 254 #else | 271 #else |
| 255 TEST_F(NaClTest, SrpcHelloWorld) { | 272 TEST_F(NaClTest, SrpcHelloWorld) { |
| 256 #endif | 273 #endif |
| 257 FilePath test_file(kSrpcHwHtmlFileName); | 274 FilePath test_file(kSrpcHwHtmlFileName); |
| 258 RunTest(test_file, NaClTestTimeout()); | 275 RunTest(test_file, NaClTestTimeout()); |
| 259 } | 276 } |
| 260 | 277 |
| 261 #if defined(OS_MACOSX) | 278 #if defined(OS_MACOSX) |
| 279 // http://code.google.com/p/nativeclient/issues/detail?id=342 |
| 262 TEST_F(NaClTest, FLAKY_SrpcBasicTest) { | 280 TEST_F(NaClTest, FLAKY_SrpcBasicTest) { |
| 263 #else | 281 #else |
| 264 TEST_F(NaClTest, SrpcBasicTest) { | 282 TEST_F(NaClTest, SrpcBasicTest) { |
| 265 #endif | 283 #endif |
| 266 FilePath test_file(kSrpcBasicHtmlFileName); | 284 FilePath test_file(kSrpcBasicHtmlFileName); |
| 267 RunTest(test_file, NaClTestTimeout()); | 285 RunTest(test_file, NaClTestTimeout()); |
| 268 } | 286 } |
| 269 | 287 |
| 270 #if defined(OS_MACOSX) | 288 #if defined(OS_MACOSX) |
| 289 // http://code.google.com/p/nativeclient/issues/detail?id=342 |
| 271 TEST_F(NaClTest, FLAKY_SrpcSockAddrTest) { | 290 TEST_F(NaClTest, FLAKY_SrpcSockAddrTest) { |
| 272 #else | 291 #else |
| 273 TEST_F(NaClTest, SrpcSockAddrTest) { | 292 TEST_F(NaClTest, SrpcSockAddrTest) { |
| 274 #endif | 293 #endif |
| 275 FilePath test_file(kSrpcSockAddrHtmlFileName); | 294 FilePath test_file(kSrpcSockAddrHtmlFileName); |
| 276 RunTest(test_file, NaClTestTimeout()); | 295 RunTest(test_file, NaClTestTimeout()); |
| 277 } | 296 } |
| 278 | 297 |
| 279 #if defined(OS_MACOSX) | 298 #if defined(OS_MACOSX) |
| 299 // http://code.google.com/p/nativeclient/issues/detail?id=342 |
| 280 TEST_F(NaClTest, FLAKY_SrpcShmTest) { | 300 TEST_F(NaClTest, FLAKY_SrpcShmTest) { |
| 281 #else | 301 #else |
| 282 TEST_F(NaClTest, SrpcShmTest) { | 302 TEST_F(NaClTest, SrpcShmTest) { |
| 283 #endif | 303 #endif |
| 284 FilePath test_file(kSrpcShmHtmlFileName); | 304 FilePath test_file(kSrpcShmHtmlFileName); |
| 285 RunTest(test_file, NaClTestTimeout()); | 305 RunTest(test_file, NaClTestTimeout()); |
| 286 } | 306 } |
| 287 | 307 |
| 288 #if defined(OS_MACOSX) | 308 #if defined(OS_MACOSX) |
| 309 // http://code.google.com/p/nativeclient/issues/detail?id=342 |
| 289 TEST_F(NaClTest, FLAKY_SrpcPluginTest) { | 310 TEST_F(NaClTest, FLAKY_SrpcPluginTest) { |
| 290 #else | 311 #else |
| 291 TEST_F(NaClTest, SrpcPluginTest) { | 312 TEST_F(NaClTest, SrpcPluginTest) { |
| 292 #endif | 313 #endif |
| 293 FilePath test_file(kSrpcPluginHtmlFileName); | 314 FilePath test_file(kSrpcPluginHtmlFileName); |
| 294 RunTest(test_file, NaClTestTimeout()); | 315 RunTest(test_file, NaClTestTimeout()); |
| 295 } | 316 } |
| 296 | 317 |
| 297 #if defined(OS_MACOSX) | 318 #if defined(OS_MACOSX) |
| 319 // http://code.google.com/p/nativeclient/issues/detail?id=342 |
| 298 TEST_F(NaClTest, FLAKY_SrpcNrdXferTest) { | 320 TEST_F(NaClTest, FLAKY_SrpcNrdXferTest) { |
| 299 #else | 321 #else |
| 300 TEST_F(NaClTest, SrpcNrdXferTest) { | 322 TEST_F(NaClTest, SrpcNrdXferTest) { |
| 301 #endif | 323 #endif |
| 302 FilePath test_file(kSrpcNrdXferHtmlFileName); | 324 FilePath test_file(kSrpcNrdXferHtmlFileName); |
| 303 RunTest(test_file, NaClTestTimeout()); | 325 RunTest(test_file, NaClTestTimeout()); |
| 304 } | 326 } |
| OLD | NEW |