OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/browser/pnacl_translation_cache.h" | 5 #include "components/nacl/browser/pnacl_translation_cache.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 | 220 |
221 TEST_F(PnaclTranslationCacheTest, StoreSmallOnDisk) { | 221 TEST_F(PnaclTranslationCacheTest, StoreSmallOnDisk) { |
222 // Test that a single store puts something in the disk backend | 222 // Test that a single store puts something in the disk backend |
223 InitBackend(false); | 223 InitBackend(false); |
224 StoreNexe(test_key, test_store_val); | 224 StoreNexe(test_key, test_store_val); |
225 EXPECT_EQ(1, cache_->Size()); | 225 EXPECT_EQ(1, cache_->Size()); |
226 } | 226 } |
227 | 227 |
228 TEST_F(PnaclTranslationCacheTest, StoreLargeOnDisk) { | 228 TEST_F(PnaclTranslationCacheTest, StoreLargeOnDisk) { |
229 #if defined(OS_WIN) | |
230 // Flaky on XP bot http://crbug.com/468741 | |
231 if (base::win::GetVersion() <= base::win::VERSION_XP) | |
232 return; | |
233 #endif | |
234 // Test a value too large(?) for a single I/O operation | 229 // Test a value too large(?) for a single I/O operation |
235 InitBackend(false); | 230 InitBackend(false); |
236 const std::string large_buffer(kLargeNexeSize, 'a'); | 231 const std::string large_buffer(kLargeNexeSize, 'a'); |
237 StoreNexe(test_key, large_buffer); | 232 StoreNexe(test_key, large_buffer); |
238 EXPECT_EQ(1, cache_->Size()); | 233 EXPECT_EQ(1, cache_->Size()); |
239 } | 234 } |
240 | 235 |
241 TEST_F(PnaclTranslationCacheTest, InMemSizeLimit) { | 236 TEST_F(PnaclTranslationCacheTest, InMemSizeLimit) { |
242 InitBackend(true); | 237 InitBackend(true); |
243 scoped_refptr<net::DrainableIOBuffer> large_buffer(new net::DrainableIOBuffer( | 238 scoped_refptr<net::DrainableIOBuffer> large_buffer(new net::DrainableIOBuffer( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 StoreNexe(test_key, test_store_val); | 295 StoreNexe(test_key, test_store_val); |
301 TestNexeCallback load_cb; | 296 TestNexeCallback load_cb; |
302 std::string nexe; | 297 std::string nexe; |
303 cache_->GetNexe(test_key + "a", load_cb.callback()); | 298 cache_->GetNexe(test_key + "a", load_cb.callback()); |
304 int rv; | 299 int rv; |
305 scoped_refptr<net::DrainableIOBuffer> buf(load_cb.GetResult(&rv)); | 300 scoped_refptr<net::DrainableIOBuffer> buf(load_cb.GetResult(&rv)); |
306 EXPECT_EQ(net::ERR_FAILED, rv); | 301 EXPECT_EQ(net::ERR_FAILED, rv); |
307 } | 302 } |
308 | 303 |
309 } // namespace pnacl | 304 } // namespace pnacl |
OLD | NEW |