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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 info.abi_version = 2; | 170 info.abi_version = 2; |
171 EXPECT_EQ("ABI:2;opt:0;URL:http://www.google.com/;" | 171 EXPECT_EQ("ABI:2;opt:0;URL:http://www.google.com/;" |
172 "modified:1995:11:15:6:25:24:0:UTC;etag:;" | 172 "modified:1995:11:15:6:25:24:0:UTC;etag:;" |
173 "sandbox:x86-32;extra_flags:;", | 173 "sandbox:x86-32;extra_flags:;", |
174 PnaclTranslationCache::GetKey(info)); | 174 PnaclTranslationCache::GetKey(info)); |
175 info.opt_level = 2; | 175 info.opt_level = 2; |
176 EXPECT_EQ("ABI:2;opt:2;URL:http://www.google.com/;" | 176 EXPECT_EQ("ABI:2;opt:2;URL:http://www.google.com/;" |
177 "modified:1995:11:15:6:25:24:0:UTC;etag:;" | 177 "modified:1995:11:15:6:25:24:0:UTC;etag:;" |
178 "sandbox:x86-32;extra_flags:;", | 178 "sandbox:x86-32;extra_flags:;", |
179 PnaclTranslationCache::GetKey(info)); | 179 PnaclTranslationCache::GetKey(info)); |
| 180 // Check that Subzero gets a different cache key. |
| 181 info.use_subzero = true; |
| 182 EXPECT_EQ("ABI:2;opt:2subzero;URL:http://www.google.com/;" |
| 183 "modified:1995:11:15:6:25:24:0:UTC;etag:;" |
| 184 "sandbox:x86-32;extra_flags:;", |
| 185 PnaclTranslationCache::GetKey(info)); |
| 186 info.use_subzero = false; |
180 info.etag = std::string("etag"); | 187 info.etag = std::string("etag"); |
181 EXPECT_EQ("ABI:2;opt:2;URL:http://www.google.com/;" | 188 EXPECT_EQ("ABI:2;opt:2;URL:http://www.google.com/;" |
182 "modified:1995:11:15:6:25:24:0:UTC;etag:etag;" | 189 "modified:1995:11:15:6:25:24:0:UTC;etag:etag;" |
183 "sandbox:x86-32;extra_flags:;", | 190 "sandbox:x86-32;extra_flags:;", |
184 PnaclTranslationCache::GetKey(info)); | 191 PnaclTranslationCache::GetKey(info)); |
185 | 192 |
186 info.extra_flags = "-mavx-neon"; | 193 info.extra_flags = "-mavx-neon"; |
187 EXPECT_EQ("ABI:2;opt:2;URL:http://www.google.com/;" | 194 EXPECT_EQ("ABI:2;opt:2;URL:http://www.google.com/;" |
188 "modified:1995:11:15:6:25:24:0:UTC;etag:etag;" | 195 "modified:1995:11:15:6:25:24:0:UTC;etag:etag;" |
189 "sandbox:x86-32;extra_flags:-mavx-neon;", | 196 "sandbox:x86-32;extra_flags:-mavx-neon;", |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 StoreNexe(test_key, test_store_val); | 299 StoreNexe(test_key, test_store_val); |
293 TestNexeCallback load_cb; | 300 TestNexeCallback load_cb; |
294 std::string nexe; | 301 std::string nexe; |
295 cache_->GetNexe(test_key + "a", load_cb.callback()); | 302 cache_->GetNexe(test_key + "a", load_cb.callback()); |
296 int rv; | 303 int rv; |
297 scoped_refptr<net::DrainableIOBuffer> buf(load_cb.GetResult(&rv)); | 304 scoped_refptr<net::DrainableIOBuffer> buf(load_cb.GetResult(&rv)); |
298 EXPECT_EQ(net::ERR_FAILED, rv); | 305 EXPECT_EQ(net::ERR_FAILED, rv); |
299 } | 306 } |
300 | 307 |
301 } // namespace pnacl | 308 } // namespace pnacl |
OLD | NEW |