| 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 #ifndef PPAPI_TESTS_TEST_UTILS_H_ | 5 #ifndef PPAPI_TESTS_TEST_UTILS_H_ |
| 6 #define PPAPI_TESTS_TEST_UTILS_H_ | 6 #define PPAPI_TESTS_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 #else | 289 #else |
| 290 #error Please add support for your platform in ppapi/tests/test_utils.h | 290 #error Please add support for your platform in ppapi/tests/test_utils.h |
| 291 #endif | 291 #endif |
| 292 | 292 |
| 293 /* These are used to determine POSIX-like implementations vs Windows. */ | 293 /* These are used to determine POSIX-like implementations vs Windows. */ |
| 294 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ | 294 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ |
| 295 defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) | 295 defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) |
| 296 #define PPAPI_POSIX 1 | 296 #define PPAPI_POSIX 1 |
| 297 #endif | 297 #endif |
| 298 | 298 |
| 299 // By default, ArrayBuffers over a certain size are sent via shared memory. In |
| 300 // order to test for this without sending huge buffers, tests can use this |
| 301 // class to set the minimum array buffer size used for shared memory temporarily |
| 302 // lower. |
| 303 class ScopedArrayBufferSizeSetter { |
| 304 public: |
| 305 ScopedArrayBufferSizeSetter(const PPB_Testing_Private* interface, |
| 306 PP_Instance instance, |
| 307 uint32_t threshold) |
| 308 : interface_(interface), |
| 309 instance_(instance) { |
| 310 interface_->SetMinimumArrayBufferSizeForShmem(instance_, threshold); |
| 311 } |
| 312 ~ScopedArrayBufferSizeSetter() { |
| 313 interface_->SetMinimumArrayBufferSizeForShmem(instance_, 0); |
| 314 } |
| 315 private: |
| 316 const PPB_Testing_Private* interface_; |
| 317 PP_Instance instance_; |
| 318 }; |
| 319 |
| 299 #endif // PPAPI_TESTS_TEST_UTILS_H_ | 320 #endif // PPAPI_TESTS_TEST_UTILS_H_ |
| OLD | NEW |