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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 for (size_t i = 0; i < kNumStrings; ++i) { | 157 for (size_t i = 0; i < kNumStrings; ++i) { |
158 ppb_var->Release(vars_[i]); | 158 ppb_var->Release(vars_[i]); |
159 } | 159 } |
160 } | 160 } |
161 private: | 161 private: |
162 std::vector<PP_Var> vars_; | 162 std::vector<PP_Var> vars_; |
163 }; | 163 }; |
164 | 164 |
165 } // namespace | 165 } // namespace |
166 | 166 |
| 167 #ifdef ENABLE_PEPPER_THREADING |
167 TEST_F(PPB_VarTest, Threads) { | 168 TEST_F(PPB_VarTest, Threads) { |
| 169 #else |
| 170 TEST_F(PPB_VarTest, DISABLED_Threads) { |
| 171 #endif |
168 std::vector<base::PlatformThreadHandle> create_var_threads(kNumThreads); | 172 std::vector<base::PlatformThreadHandle> create_var_threads(kNumThreads); |
169 std::vector<CreateVarThreadDelegate> create_var_delegates; | 173 std::vector<CreateVarThreadDelegate> create_var_delegates; |
170 // The strings that the threads will re-extract from Vars (so we can check | 174 // The strings that the threads will re-extract from Vars (so we can check |
171 // that they match the original strings). | 175 // that they match the original strings). |
172 std::vector<std::string> strings_out(kNumStrings); | 176 std::vector<std::string> strings_out(kNumStrings); |
173 size_t strings_per_thread = kNumStrings/kNumThreads; | 177 size_t strings_per_thread = kNumStrings/kNumThreads; |
174 // Give each thread an equal slice of strings to turn in to vars. (Except the | 178 // Give each thread an equal slice of strings to turn in to vars. (Except the |
175 // last thread may get fewer if kNumStrings is not evenly divisible by | 179 // last thread may get fewer if kNumStrings is not evenly divisible by |
176 // kNumThreads). | 180 // kNumThreads). |
177 for (size_t slice_start= 0; slice_start < kNumStrings; | 181 for (size_t slice_start= 0; slice_start < kNumStrings; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 for (size_t i = 0; i < kNumStrings; ++i) { | 236 for (size_t i = 0; i < kNumStrings; ++i) { |
233 uint32_t len = 10; | 237 uint32_t len = 10; |
234 const char* utf8 = ppb_var_->VarToUtf8(vars_[i], &len); | 238 const char* utf8 = ppb_var_->VarToUtf8(vars_[i], &len); |
235 EXPECT_EQ(NULL, utf8); | 239 EXPECT_EQ(NULL, utf8); |
236 EXPECT_EQ(0u, len); | 240 EXPECT_EQ(0u, len); |
237 } | 241 } |
238 } | 242 } |
239 | 243 |
240 } // namespace proxy | 244 } // namespace proxy |
241 } // namespace ppapi | 245 } // namespace ppapi |
OLD | NEW |