| Index: chrome/browser/nacl_host/pnacl_host_unittest.cc
|
| diff --git a/chrome/browser/nacl_host/pnacl_host_unittest.cc b/chrome/browser/nacl_host/pnacl_host_unittest.cc
|
| index 0ad9cd5ae678e42a03f0ef6e49b1860476a651d0..881e1f709b4332af205c0f543c7c21539b9cd1a7 100644
|
| --- a/chrome/browser/nacl_host/pnacl_host_unittest.cc
|
| +++ b/chrome/browser/nacl_host/pnacl_host_unittest.cc
|
| @@ -99,6 +99,7 @@ static nacl::PnaclCacheInfo GetTestCacheInfo() {
|
| info.pexe_url = GURL("http://www.google.com");
|
| info.abi_version = 0;
|
| info.opt_level = 0;
|
| + info.has_no_store_header = false;
|
| return info;
|
| }
|
|
|
| @@ -164,7 +165,6 @@ TEST_F(PnaclHostTest, BasicHit) {
|
|
|
| TEST_F(PnaclHostTest, TranslationErrors) {
|
| nacl::PnaclCacheInfo info = GetTestCacheInfo();
|
| - info.pexe_url = GURL("http://www.google.com");
|
| GET_NEXE_FD(0, 0, false, info, false);
|
| // Early abort, before temp file request returns
|
| host_->TranslationFinished(0, 0, false);
|
| @@ -347,6 +347,45 @@ TEST_F(PnaclHostTest, IncognitoSecondOverlappedMiss) {
|
| EXPECT_EQ(0U, host_->pending_translations());
|
| }
|
|
|
| +// Test that pexes with the no-store header do not get cached.
|
| +TEST_F(PnaclHostTest, CacheControlNoStore) {
|
| + nacl::PnaclCacheInfo info = GetTestCacheInfo();
|
| + info.has_no_store_header = true;
|
| + GET_NEXE_FD(0, 0, false, info, false);
|
| + FlushQueues();
|
| + EXPECT_EQ(1, temp_callback_count_);
|
| + host_->TranslationFinished(0, 0, true);
|
| + FlushQueues();
|
| + EXPECT_EQ(0U, host_->pending_translations());
|
| + EXPECT_EQ(0, GetCacheSize());
|
| +}
|
| +
|
| +// Test that no-store pexes do not wait, but do duplicate translations
|
| +TEST_F(PnaclHostTest, NoStoreOverlappedMiss) {
|
| + nacl::PnaclCacheInfo info = GetTestCacheInfo();
|
| + info.has_no_store_header = true;
|
| + GET_NEXE_FD(0, 0, false, info, false);
|
| + GET_NEXE_FD(0, 1, false, info, false);
|
| + FlushQueues();
|
| + // Check that both translations have returned misses, (i.e. that the
|
| + // second one has not blocked on the first one)
|
| + EXPECT_EQ(2, temp_callback_count_);
|
| + host_->TranslationFinished(0, 0, true);
|
| + host_->TranslationFinished(0, 1, true);
|
| + FlushQueues();
|
| + EXPECT_EQ(0U, host_->pending_translations());
|
| +
|
| + // Same test, but issue the 2nd request after the first has returned a miss.
|
| + info.abi_version = 222;
|
| + GET_NEXE_FD(0, 0, false, info, false);
|
| + FlushQueues();
|
| + EXPECT_EQ(3, temp_callback_count_);
|
| + GET_NEXE_FD(0, 1, false, info, false);
|
| + FlushQueues();
|
| + EXPECT_EQ(4, temp_callback_count_);
|
| + host_->RendererClosing(0);
|
| +}
|
| +
|
| TEST_F(PnaclHostTest, ClearTranslationCache) {
|
| nacl::PnaclCacheInfo info = GetTestCacheInfo();
|
| // Add 2 entries in the cache
|
|
|