| 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 "chrome/browser/nacl_host/pnacl_host.h" | 5 #include "chrome/browser/nacl_host/pnacl_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 0, | 66 0, |
| 67 0, | 67 0, |
| 68 info, | 68 info, |
| 69 base::Bind(&PnaclHostTest::CallbackExpectMiss, base::Unretained(this))); | 69 base::Bind(&PnaclHostTest::CallbackExpectMiss, base::Unretained(this))); |
| 70 | 70 |
| 71 EXPECT_PENDING_TRANSLATIONS(1); | 71 EXPECT_PENDING_TRANSLATIONS(1); |
| 72 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 72 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
| 73 base::RunLoop().RunUntilIdle(); | 73 base::RunLoop().RunUntilIdle(); |
| 74 EXPECT_PENDING_TRANSLATIONS(1); | 74 EXPECT_PENDING_TRANSLATIONS(1); |
| 75 ExpectCallbackCount(1); | 75 ExpectCallbackCount(1); |
| 76 host_->TranslationFinished(0, 0); | 76 host_->TranslationFinished(0, 0, true); |
| 77 EXPECT_PENDING_TRANSLATIONS(0); | 77 EXPECT_PENDING_TRANSLATIONS(0); |
| 78 host_->RendererClosing(0); | 78 host_->RendererClosing(0); |
| 79 } | 79 } |
| 80 | 80 |
| 81 TEST_F(PnaclHostTest, BadArguments) { | 81 TEST_F(PnaclHostTest, BadArguments) { |
| 82 nacl::PnaclCacheInfo info; | 82 nacl::PnaclCacheInfo info; |
| 83 host_->GetNexeFd( | 83 host_->GetNexeFd( |
| 84 0, | 84 0, |
| 85 base::ProcessHandle(), | 85 base::ProcessHandle(), |
| 86 0, | 86 0, |
| 87 0, | 87 0, |
| 88 info, | 88 info, |
| 89 base::Bind(&PnaclHostTest::CallbackExpectMiss, base::Unretained(this))); | 89 base::Bind(&PnaclHostTest::CallbackExpectMiss, base::Unretained(this))); |
| 90 | 90 |
| 91 EXPECT_PENDING_TRANSLATIONS(1); | 91 EXPECT_PENDING_TRANSLATIONS(1); |
| 92 host_->TranslationFinished(0, 1); // nonexistent translation | 92 host_->TranslationFinished(0, 1, true); // nonexistent translation |
| 93 EXPECT_PENDING_TRANSLATIONS(1); | 93 EXPECT_PENDING_TRANSLATIONS(1); |
| 94 host_->RendererClosing(1); // nonexistent renderer | 94 host_->RendererClosing(1); // nonexistent renderer |
| 95 EXPECT_PENDING_TRANSLATIONS(1); | 95 EXPECT_PENDING_TRANSLATIONS(1); |
| 96 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 96 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
| 97 base::RunLoop().RunUntilIdle(); | 97 base::RunLoop().RunUntilIdle(); |
| 98 ExpectCallbackCount(1); | 98 ExpectCallbackCount(1); |
| 99 host_->RendererClosing(0); // close without finishing | 99 host_->RendererClosing(0); // close without finishing |
| 100 EXPECT_PENDING_TRANSLATIONS(0); | 100 EXPECT_PENDING_TRANSLATIONS(0); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace pnacl | 103 } // namespace pnacl |
| OLD | NEW |