| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 enum InitializationState {kUnset, kUnintialized, kInitialized}; | 44 enum InitializationState {kUnset, kUnintialized, kInitialized}; |
| 45 static InitializationState initialization_state_ = kUnset; | 45 static InitializationState initialization_state_ = kUnset; |
| 46 static bool disable_automatic_dispose_ = false; | 46 static bool disable_automatic_dispose_ = false; |
| 47 | 47 |
| 48 CcTest* CcTest::last_ = NULL; | 48 CcTest* CcTest::last_ = NULL; |
| 49 bool CcTest::initialize_called_ = false; | 49 bool CcTest::initialize_called_ = false; |
| 50 v8::base::Atomic32 CcTest::isolate_used_ = 0; | 50 v8::base::Atomic32 CcTest::isolate_used_ = 0; |
| 51 v8::ArrayBuffer::Allocator* CcTest::allocator_ = NULL; | 51 v8::ArrayBuffer::Allocator* CcTest::allocator_ = NULL; |
| 52 v8::Isolate* CcTest::isolate_ = NULL; | 52 v8::Isolate* CcTest::isolate_ = NULL; |
| 53 | 53 |
| 54 | |
| 55 CcTest::CcTest(TestFunction* callback, const char* file, const char* name, | 54 CcTest::CcTest(TestFunction* callback, const char* file, const char* name, |
| 56 const char* dependency, bool enabled, bool initialize) | 55 bool enabled, bool initialize) |
| 57 : callback_(callback), name_(name), dependency_(dependency), | 56 : callback_(callback), |
| 58 enabled_(enabled), initialize_(initialize), prev_(last_) { | 57 name_(name), |
| 58 enabled_(enabled), |
| 59 initialize_(initialize), |
| 60 prev_(last_) { |
| 59 // Find the base name of this test (const_cast required on Windows). | 61 // Find the base name of this test (const_cast required on Windows). |
| 60 char *basename = strrchr(const_cast<char *>(file), '/'); | 62 char *basename = strrchr(const_cast<char *>(file), '/'); |
| 61 if (!basename) { | 63 if (!basename) { |
| 62 basename = strrchr(const_cast<char *>(file), '\\'); | 64 basename = strrchr(const_cast<char *>(file), '\\'); |
| 63 } | 65 } |
| 64 if (!basename) { | 66 if (!basename) { |
| 65 basename = v8::internal::StrDup(file); | 67 basename = v8::internal::StrDup(file); |
| 66 } else { | 68 } else { |
| 67 basename = v8::internal::StrDup(basename + 1); | 69 basename = v8::internal::StrDup(basename + 1); |
| 68 } | 70 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 123 |
| 122 void CcTest::DisableAutomaticDispose() { | 124 void CcTest::DisableAutomaticDispose() { |
| 123 CHECK_EQ(kUnintialized, initialization_state_); | 125 CHECK_EQ(kUnintialized, initialization_state_); |
| 124 disable_automatic_dispose_ = true; | 126 disable_automatic_dispose_ = true; |
| 125 } | 127 } |
| 126 | 128 |
| 127 | 129 |
| 128 static void PrintTestList(CcTest* current) { | 130 static void PrintTestList(CcTest* current) { |
| 129 if (current == NULL) return; | 131 if (current == NULL) return; |
| 130 PrintTestList(current->prev()); | 132 PrintTestList(current->prev()); |
| 131 if (current->dependency() != NULL) { | 133 printf("%s/%s\n", current->file(), current->name()); |
| 132 printf("%s/%s<%s\n", | |
| 133 current->file(), current->name(), current->dependency()); | |
| 134 } else { | |
| 135 printf("%s/%s<\n", current->file(), current->name()); | |
| 136 } | |
| 137 } | 134 } |
| 138 | 135 |
| 139 | 136 |
| 140 class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator { | 137 class CcTestArrayBufferAllocator : public v8::ArrayBuffer::Allocator { |
| 141 virtual void* Allocate(size_t length) { | 138 virtual void* Allocate(size_t length) { |
| 142 void* data = AllocateUninitialized(length); | 139 void* data = AllocateUninitialized(length); |
| 143 return data == NULL ? data : memset(data, 0, length); | 140 return data == NULL ? data : memset(data, 0, length); |
| 144 } | 141 } |
| 145 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } | 142 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } |
| 146 virtual void Free(void* data, size_t length) { free(data); } | 143 virtual void Free(void* data, size_t length) { free(data); } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 CcTest::TearDown(); | 251 CcTest::TearDown(); |
| 255 // TODO(svenpanne) See comment above. | 252 // TODO(svenpanne) See comment above. |
| 256 // if (!disable_automatic_dispose_) v8::V8::Dispose(); | 253 // if (!disable_automatic_dispose_) v8::V8::Dispose(); |
| 257 v8::V8::ShutdownPlatform(); | 254 v8::V8::ShutdownPlatform(); |
| 258 delete platform; | 255 delete platform; |
| 259 return 0; | 256 return 0; |
| 260 } | 257 } |
| 261 | 258 |
| 262 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; | 259 RegisterThreadedTest *RegisterThreadedTest::first_ = NULL; |
| 263 int RegisterThreadedTest::count_ = 0; | 260 int RegisterThreadedTest::count_ = 0; |
| OLD | NEW |