diff options
40 files changed, 228 insertions, 228 deletions
diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc index 82390a6..8b4a076 100644 --- a/content/browser/appcache/chrome_appcache_service_unittest.cc +++ b/content/browser/appcache/chrome_appcache_service_unittest.cc @@ -116,14 +116,14 @@ ChromeAppCacheServiceTest::CreateAppCacheService( mock_request_context_getter, mock_policy)); // Steps needed to initialize the storage of AppCache data. - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); if (init_storage) { appcache::AppCacheStorageImpl* storage = static_cast<appcache::AppCacheStorageImpl*>( appcache_service->storage()); storage->database_->db_connection(); storage->disk_cache(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } return appcache_service; } @@ -158,7 +158,7 @@ TEST_F(ChromeAppCacheServiceTest, KeepOnDestruction) { // Test: delete the ChromeAppCacheService appcache_service = NULL; - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Recreate the appcache (for reading the data back) appcache_service = CreateAppCacheService(appcache_path, false); @@ -178,7 +178,7 @@ TEST_F(ChromeAppCacheServiceTest, KeepOnDestruction) { // Delete and let cleanup tasks run prior to returning. appcache_service = NULL; - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } TEST_F(ChromeAppCacheServiceTest, SaveSessionState) { @@ -197,7 +197,7 @@ TEST_F(ChromeAppCacheServiceTest, SaveSessionState) { // Test: delete the ChromeAppCacheService appcache_service = NULL; - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Recreate the appcache (for reading the data back) appcache_service = CreateAppCacheService(appcache_path, false); @@ -217,7 +217,7 @@ TEST_F(ChromeAppCacheServiceTest, SaveSessionState) { // Delete and let cleanup tasks run prior to returning. appcache_service = NULL; - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } } // namespace content diff --git a/content/browser/download/byte_stream_unittest.cc b/content/browser/download/byte_stream_unittest.cc index 1f1d669..3f235f2 100644 --- a/content/browser/download/byte_stream_unittest.cc +++ b/content/browser/download/byte_stream_unittest.cc @@ -150,7 +150,7 @@ TEST_F(ByteStreamTest, ByteStream_PushBack) { EXPECT_FALSE(Write(byte_stream_input.get(), 1024)); // Flush byte_stream_input->Close(DOWNLOAD_INTERRUPT_REASON_NONE); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Pull the IO buffers out; do we get the same buffers and do they // have the same contents? @@ -193,15 +193,15 @@ TEST_F(ByteStreamTest, ByteStream_PushBackSplit) { // Push a series of IO buffers on; test pushback happening and // that it's advisory. EXPECT_TRUE(Write(byte_stream_input.get(), 1024)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_TRUE(Write(byte_stream_input.get(), 1024)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_TRUE(Write(byte_stream_input.get(), 1024)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_TRUE(Write(byte_stream_input.get(), 1024)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_FALSE(Write(byte_stream_input.get(), 6 * 1024)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Pull the IO buffers out; do we get the same buffers and do they // have the same contents? @@ -247,7 +247,7 @@ TEST_F(ByteStreamTest, ByteStream_CompleteTransmits) { EXPECT_EQ(ByteStreamReader::STREAM_EMPTY, byte_stream_output->Read(&output_io_buffer, &output_length)); byte_stream_input->Close(DOWNLOAD_INTERRUPT_REASON_NONE); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); ASSERT_EQ(ByteStreamReader::STREAM_COMPLETE, byte_stream_output->Read(&output_io_buffer, &output_length)); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, @@ -261,7 +261,7 @@ TEST_F(ByteStreamTest, ByteStream_CompleteTransmits) { byte_stream_output->Read(&output_io_buffer, &output_length)); EXPECT_TRUE(Write(byte_stream_input.get(), 1024)); byte_stream_input->Close(DOWNLOAD_INTERRUPT_REASON_NONE); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_EQ(ByteStreamReader::STREAM_HAS_DATA, byte_stream_output->Read(&output_io_buffer, &output_length)); EXPECT_TRUE(ValidateIOBuffer(output_io_buffer, output_length)); @@ -277,7 +277,7 @@ TEST_F(ByteStreamTest, ByteStream_CompleteTransmits) { EXPECT_EQ(ByteStreamReader::STREAM_EMPTY, byte_stream_output->Read(&output_io_buffer, &output_length)); byte_stream_input->Close(DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); ASSERT_EQ(ByteStreamReader::STREAM_COMPLETE, byte_stream_output->Read(&output_io_buffer, &output_length)); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, @@ -291,7 +291,7 @@ TEST_F(ByteStreamTest, ByteStream_CompleteTransmits) { byte_stream_output->Read(&output_io_buffer, &output_length)); EXPECT_TRUE(Write(byte_stream_input.get(), 1024)); byte_stream_input->Close(DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_EQ(ByteStreamReader::STREAM_HAS_DATA, byte_stream_output->Read(&output_io_buffer, &output_length)); EXPECT_TRUE(ValidateIOBuffer(output_io_buffer, output_length)); @@ -333,7 +333,7 @@ TEST_F(ByteStreamTest, ByteStream_SinkCallback) { Return(true))); EXPECT_TRUE(Write(byte_stream_input.get(), 4000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Check callback results match expectations. ::testing::Mock::VerifyAndClearExpectations(task_runner.get()); @@ -353,7 +353,7 @@ TEST_F(ByteStreamTest, ByteStream_SinkCallback) { // Confirm callback *isn't* called at less than 33% (by lack of // unexpected call on task runner). EXPECT_TRUE(Write(byte_stream_input.get(), 3000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // This reflects an implementation artifact that data goes with callbacks, // which should not be considered part of the interface guarantee. @@ -396,7 +396,7 @@ TEST_F(ByteStreamTest, ByteStream_SourceCallback) { // Allow bytes to transition (needed for message passing implementation), // and get and validate the data. - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_EQ(ByteStreamReader::STREAM_HAS_DATA, byte_stream_output->Read(&output_io_buffer, &output_length)); EXPECT_TRUE(ValidateIOBuffer(output_io_buffer, output_length)); @@ -466,7 +466,7 @@ TEST_F(ByteStreamTest, ByteStream_SinkInterrupt) { // Add data, and pass it across. EXPECT_TRUE(Write(byte_stream_input.get(), 4000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // The task runner should have been hit, but the callback count // isn't changed until we actually run the callback. @@ -517,13 +517,13 @@ TEST_F(ByteStreamTest, ByteStream_SourceInterrupt) { EXPECT_TRUE(Write(byte_stream_input.get(), 2000)); EXPECT_TRUE(Write(byte_stream_input.get(), 2001)); EXPECT_FALSE(Write(byte_stream_input.get(), 6000)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Initial get should not trigger callback. EXPECT_EQ(ByteStreamReader::STREAM_HAS_DATA, byte_stream_output->Read(&output_io_buffer, &output_length)); EXPECT_TRUE(ValidateIOBuffer(output_io_buffer, output_length)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // Setup expectations. EXPECT_CALL(*task_runner.get(), PostDelayedTask(_, _, base::TimeDelta())) diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 9db6c33..5708906 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -152,7 +152,7 @@ class DownloadFileTest : public testing::Test { download_file_->Initialize(base::Bind( &DownloadFileTest::SetInterruptReasonCallback, weak_ptr_factory.GetWeakPtr(), &called, &result)); - loop_.RunAllPending(); + loop_.RunUntilIdle(); EXPECT_TRUE(called); ::testing::Mock::VerifyAndClearExpectations(input_stream_); @@ -236,7 +236,7 @@ class DownloadFileTest : public testing::Test { VerifyStreamAndSize(); if (check_observer) { EXPECT_CALL(*(observer_.get()), DestinationCompleted(_)); - loop_.RunAllPending(); + loop_.RunUntilIdle(); ::testing::Mock::VerifyAndClearExpectations(observer_.get()); EXPECT_CALL(*(observer_.get()), DestinationUpdate(_, _, _)) .Times(AnyNumber()) @@ -277,7 +277,7 @@ class DownloadFileTest : public testing::Test { weak_ptr_factory.GetWeakPtr(), &callback_was_called, &result_reason, result_path_p)); - loop_.RunAllPending(); + loop_.RunUntilIdle(); EXPECT_TRUE(callback_was_called); return result_reason; @@ -395,7 +395,7 @@ TEST_F(DownloadFileTest, RenameFileFinal) { std::string hash; EXPECT_FALSE(download_file_->GetHash(&hash)); FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); - loop_.RunAllPending(); + loop_.RunUntilIdle(); // Rename the file after downloading all the data and closing the file. EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, @@ -452,7 +452,7 @@ TEST_F(DownloadFileTest, RenameUniquifies) { EXPECT_TRUE(file_util::PathExists(path_1_suffixed)); FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); - loop_.RunAllPending(); + loop_.RunUntilIdle(); DestroyDownloadFile(0); } @@ -484,7 +484,7 @@ TEST_F(DownloadFileTest, RenameError) { } FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); - loop_.RunAllPending(); + loop_.RunUntilIdle(); DestroyDownloadFile(0); } @@ -502,7 +502,7 @@ TEST_F(DownloadFileTest, StreamEmptySuccess) { // observer. EXPECT_CALL(*(observer_.get()), DestinationCompleted(_)); FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, false); - loop_.RunAllPending(); + loop_.RunUntilIdle(); DestroyDownloadFile(0); } @@ -529,7 +529,7 @@ TEST_F(DownloadFileTest, StreamEmptyError) { FinishStream(DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, false); - loop_.RunAllPending(); + loop_.RunUntilIdle(); DestroyDownloadFile(0); } @@ -546,7 +546,7 @@ TEST_F(DownloadFileTest, StreamNonEmptySuccess) { EXPECT_CALL(*(observer_.get()), DestinationCompleted(_)); sink_callback_.Run(); VerifyStreamAndSize(); - loop_.RunAllPending(); + loop_.RunUntilIdle(); DestroyDownloadFile(0); } @@ -576,7 +576,7 @@ TEST_F(DownloadFileTest, StreamNonEmptyError) { _, _)); sink_callback_.Run(); - loop_.RunAllPending(); + loop_.RunUntilIdle(); VerifyStreamAndSize(); DestroyDownloadFile(0); } diff --git a/content/browser/download/download_item_impl_unittest.cc b/content/browser/download/download_item_impl_unittest.cc index 49e0597..b20873b 100644 --- a/content/browser/download/download_item_impl_unittest.cc +++ b/content/browser/download/download_item_impl_unittest.cc @@ -141,7 +141,7 @@ class DownloadItemTest : public testing::Test { } virtual void TearDown() { - ui_thread_.DeprecatedGetThreadObject()->message_loop()->RunAllPending(); + ui_thread_.DeprecatedGetThreadObject()->message_loop()->RunUntilIdle(); STLDeleteElements(&allocated_downloads_); allocated_downloads_.clear(); } @@ -188,7 +188,7 @@ class DownloadItemTest : public testing::Test { } item->Start(download_file.Pass()); - loop_.RunAllPending(); + loop_.RunUntilIdle(); // So that we don't have a function writing to a stack variable // lying around if the above failed. @@ -205,7 +205,7 @@ class DownloadItemTest : public testing::Test { EXPECT_CALL(*download_file, Cancel()); EXPECT_CALL(delegate_, DownloadStopped(item)); item->Cancel(true); - loop_.RunAllPending(); + loop_.RunUntilIdle(); } // Destroy a previously created download item. @@ -215,7 +215,7 @@ class DownloadItemTest : public testing::Test { } void RunAllPendingInMessageLoops() { - loop_.RunAllPending(); + loop_.RunUntilIdle(); } MockDelegate* mock_delegate() { diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc index 7084f71..2bf454c 100644 --- a/content/browser/download/download_manager_impl_unittest.cc +++ b/content/browser/download/download_manager_impl_unittest.cc @@ -463,10 +463,10 @@ class DownloadManagerTest : public testing::Test { download_manager_->Shutdown(); download_manager_ = NULL; - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); ASSERT_EQ(NULL, mock_download_item_factory_.get()); ASSERT_EQ(NULL, mock_download_file_factory_.get()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); mock_download_manager_delegate_.reset(); mock_browser_context_.reset(); } diff --git a/content/browser/gamepad/gamepad_provider_unittest.cc b/content/browser/gamepad/gamepad_provider_unittest.cc index 30f5e43..18bafc3 100644 --- a/content/browser/gamepad/gamepad_provider_unittest.cc +++ b/content/browser/gamepad/gamepad_provider_unittest.cc @@ -79,7 +79,7 @@ TEST_F(GamepadProviderTest, PollingAccess) { GamepadProvider* provider = CreateProvider(test_data); provider->Resume(); - message_loop().RunAllPending(); + message_loop().RunUntilIdle(); mock_data_fetcher_->WaitForDataRead(); @@ -135,7 +135,7 @@ TEST_F(GamepadProviderTest, UserGesture) { mock_data_fetcher_->WaitForDataRead(); // It should not have issued our callback. - message_loop().RunAllPending(); + message_loop().RunUntilIdle(); EXPECT_FALSE(listener.has_user_gesture()); // Set a button down and wait for it to be read twice. @@ -150,7 +150,7 @@ TEST_F(GamepadProviderTest, UserGesture) { mock_data_fetcher_->WaitForDataRead(); // It should have issued our callback. - message_loop().RunAllPending(); + message_loop().RunUntilIdle(); EXPECT_TRUE(listener.has_user_gesture()); } diff --git a/content/browser/geolocation/device_data_provider_unittest.cc b/content/browser/geolocation/device_data_provider_unittest.cc index 87b896c..f39c7e0 100644 --- a/content/browser/geolocation/device_data_provider_unittest.cc +++ b/content/browser/geolocation/device_data_provider_unittest.cc @@ -28,12 +28,12 @@ TEST(GeolocationDeviceDataProviderWifiData, CreateDestroy) { DeviceDataProvider<WifiData>::Register(&listener); for (int j = 0; j < 10; j++) { base::PlatformThread::Sleep(base::TimeDelta()); - main_message_loop.RunAllPending(); // See comment above + main_message_loop.RunUntilIdle(); // See comment above } DeviceDataProvider<WifiData>::Unregister(&listener); for (int j = 0; j < 10; j++) { base::PlatformThread::Sleep(base::TimeDelta()); - main_message_loop.RunAllPending(); // See comment above + main_message_loop.RunUntilIdle(); // See comment above } } } diff --git a/content/browser/geolocation/network_location_provider_unittest.cc b/content/browser/geolocation/network_location_provider_unittest.cc index 14b2edb..b70a334 100644 --- a/content/browser/geolocation/network_location_provider_unittest.cc +++ b/content/browser/geolocation/network_location_provider_unittest.cc @@ -361,7 +361,7 @@ TEST_F(GeolocationNetworkProviderTest, StartProviderLongRequest) { EXPECT_TRUE(provider->StartProvider(false)); const int kFirstScanAps = 20; wifi_data_provider_->SetData(CreateReferenceWifiScanData(kFirstScanAps)); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); net::TestURLFetcher* fetcher = get_url_fetcher_and_advance_id(); ASSERT_TRUE(fetcher != NULL); // The request url should have been shortened to less than 2048 characters @@ -413,7 +413,7 @@ TEST_F(GeolocationNetworkProviderTest, MultipleWifiScansComplete) { // Now wifi data arrives -- SetData will notify listeners. const int kFirstScanAps = 6; wifi_data_provider_->SetData(CreateReferenceWifiScanData(kFirstScanAps)); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); fetcher = get_url_fetcher_and_advance_id(); ASSERT_TRUE(fetcher != NULL); // The request should have the wifi data. @@ -450,7 +450,7 @@ TEST_F(GeolocationNetworkProviderTest, MultipleWifiScansComplete) { // previous scan, so no new request made. const int kSecondScanAps = kFirstScanAps - 1; wifi_data_provider_->SetData(CreateReferenceWifiScanData(kSecondScanAps)); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); fetcher = get_url_fetcher_and_advance_id(); EXPECT_FALSE(fetcher); @@ -462,7 +462,7 @@ TEST_F(GeolocationNetworkProviderTest, MultipleWifiScansComplete) { // Now a third scan with more than twice the original amount -> new request. const int kThirdScanAps = kFirstScanAps * 2 + 1; wifi_data_provider_->SetData(CreateReferenceWifiScanData(kThirdScanAps)); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); fetcher = get_url_fetcher_and_advance_id(); EXPECT_TRUE(fetcher); CheckRequestIsValid(*fetcher, 0, kThirdScanAps, 0, REFERENCE_ACCESS_TOKEN); @@ -480,7 +480,7 @@ TEST_F(GeolocationNetworkProviderTest, MultipleWifiScansComplete) { // Wifi scan returns to original set: should be serviced from cache. wifi_data_provider_->SetData(CreateReferenceWifiScanData(kFirstScanAps)); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); EXPECT_FALSE(get_url_fetcher_and_advance_id()); // No new request created. provider->GetPosition(&position); @@ -496,13 +496,13 @@ TEST_F(GeolocationNetworkProviderTest, NoRequestOnStartupUntilWifiData) { EXPECT_TRUE(provider->StartProvider(false)); provider->RegisterListener(&listener); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); EXPECT_FALSE(get_url_fetcher_and_advance_id()) << "Network request should not be created right away on startup when " "wifi data has not yet arrived"; wifi_data_provider_->SetData(CreateReferenceWifiScanData(1)); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); EXPECT_TRUE(get_url_fetcher_and_advance_id()); } @@ -515,7 +515,7 @@ TEST_F(GeolocationNetworkProviderTest, NewDataReplacesExistingNetworkRequest) { // Now wifi data arrives; new request should be sent. wifi_data_provider_->SetData(CreateReferenceWifiScanData(4)); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); fetcher = get_url_fetcher_and_advance_id(); EXPECT_TRUE(fetcher); } @@ -544,7 +544,7 @@ TEST_F(GeolocationNetworkProviderTest, static const int kScanCount = 4; wifi_data_provider_->SetData(CreateReferenceWifiScanData(kScanCount)); - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); fetcher = get_url_fetcher_and_advance_id(); EXPECT_FALSE(fetcher); diff --git a/content/browser/geolocation/win7_location_provider_unittest_win.cc b/content/browser/geolocation/win7_location_provider_unittest_win.cc index ecb4bc3..9c2e299 100644 --- a/content/browser/geolocation/win7_location_provider_unittest_win.cc +++ b/content/browser/geolocation/win7_location_provider_unittest_win.cc @@ -91,7 +91,7 @@ class GeolocationProviderWin7Tests : public testing::Test { provider_->UnregisterListener(&location_listener_); provider_->StopProvider(); delete provider_; - main_message_loop_.RunAllPending(); + main_message_loop_.RunUntilIdle(); } protected: diff --git a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc index 5e58e38..f1d7e4b 100644 --- a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc +++ b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc @@ -50,7 +50,7 @@ class IndexedDBQuotaClientTest : public testing::Test { idb_context_ = static_cast<IndexedDBContextImpl*>( BrowserContext::GetDefaultStoragePartition(browser_context_.get())-> GetIndexedDBContext()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); setup_temp_dir(); } void setup_temp_dir() { @@ -68,7 +68,7 @@ class IndexedDBQuotaClientTest : public testing::Test { // doesn't outlive BrowserThread::WEBKIT_DEPRECATED. idb_context_ = NULL; browser_context_.reset(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } int64 GetOriginUsage( @@ -80,7 +80,7 @@ class IndexedDBQuotaClientTest : public testing::Test { origin, type, base::Bind(&IndexedDBQuotaClientTest::OnGetOriginUsageComplete, weak_factory_.GetWeakPtr())); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_GT(usage_, -1); return usage_; } @@ -94,7 +94,7 @@ class IndexedDBQuotaClientTest : public testing::Test { type, base::Bind(&IndexedDBQuotaClientTest::OnGetOriginsComplete, weak_factory_.GetWeakPtr())); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); return origins_; } @@ -108,7 +108,7 @@ class IndexedDBQuotaClientTest : public testing::Test { type, host, base::Bind(&IndexedDBQuotaClientTest::OnGetOriginsComplete, weak_factory_.GetWeakPtr())); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); return origins_; } @@ -119,7 +119,7 @@ class IndexedDBQuotaClientTest : public testing::Test { origin_url, kTemp, base::Bind(&IndexedDBQuotaClientTest::OnDeleteOriginComplete, weak_factory_.GetWeakPtr())); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); return delete_status_; } diff --git a/content/browser/in_process_webkit/indexed_db_unittest.cc b/content/browser/in_process_webkit/indexed_db_unittest.cc index c1f8454..08af7da 100644 --- a/content/browser/in_process_webkit/indexed_db_unittest.cc +++ b/content/browser/in_process_webkit/indexed_db_unittest.cc @@ -73,10 +73,10 @@ TEST_F(IndexedDBTest, ClearSessionOnlyDatabases) { DatabaseUtil::GetOriginIdentifier(kSessionOnlyOrigin)); ASSERT_TRUE(file_util::CreateDirectory(normal_path)); ASSERT_TRUE(file_util::CreateDirectory(session_only_path)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_TRUE(file_util::DirectoryExists(normal_path)); EXPECT_FALSE(file_util::DirectoryExists(session_only_path)); @@ -120,11 +120,11 @@ TEST_F(IndexedDBTest, SetForceKeepSessionState) { DatabaseUtil::GetOriginIdentifier(kSessionOnlyOrigin)); ASSERT_TRUE(file_util::CreateDirectory(normal_path)); ASSERT_TRUE(file_util::CreateDirectory(session_only_path)); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Make sure we wait until the destructor has run. - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); // No data was cleared because of SetForceKeepSessionState. EXPECT_TRUE(file_util::DirectoryExists(normal_path)); @@ -191,11 +191,11 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) { idb_context->DeleteForOrigin(kTestOrigin); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Make sure we wait until the destructor has run. - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_FALSE(file_util::DirectoryExists(test_path)); } diff --git a/content/browser/plugin_loader_posix_unittest.cc b/content/browser/plugin_loader_posix_unittest.cc index 5c8e200..dd10cee 100644 --- a/content/browser/plugin_loader_posix_unittest.cc +++ b/content/browser/plugin_loader_posix_unittest.cc @@ -117,14 +117,14 @@ TEST_F(PluginLoaderPosixTest, QueueRequests) { EXPECT_EQ(2u, plugin_loader()->number_of_pending_callbacks()); EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(2); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); plugin_loader()->canonical_list()->clear(); plugin_loader()->canonical_list()->push_back(plugin1_.path); plugin_loader()->TestOnPluginLoaded(0, plugin1_); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(1, did_callback); EXPECT_EQ(1u, plugin_loader()->number_of_pending_callbacks()); @@ -132,7 +132,7 @@ TEST_F(PluginLoaderPosixTest, QueueRequests) { plugin_loader()->canonical_list()->clear(); plugin_loader()->canonical_list()->push_back(plugin1_.path); plugin_loader()->TestOnPluginLoaded(0, plugin1_); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(2, did_callback); EXPECT_EQ(0u, plugin_loader()->number_of_pending_callbacks()); @@ -146,7 +146,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoads) { plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(1); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); AddThreePlugins(); @@ -160,7 +160,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoads) { EXPECT_EQ(1u, plugins.size()); EXPECT_EQ(plugin1_.name, plugins[0].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); plugin_loader()->TestOnPluginLoaded(1, plugin2_); @@ -168,14 +168,14 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoads) { EXPECT_EQ(2u, plugins.size()); EXPECT_EQ(plugin2_.name, plugins[1].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); plugin_loader()->TestOnPluginLoaded(2, plugin3_); EXPECT_EQ(3u, plugins.size()); EXPECT_EQ(plugin3_.name, plugins[2].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(1, did_callback); } @@ -187,7 +187,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoadsThenCrash) { plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(2); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); AddThreePlugins(); @@ -201,7 +201,7 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoadsThenCrash) { EXPECT_EQ(1u, plugins.size()); EXPECT_EQ(plugin1_.name, plugins[0].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); plugin_loader()->TestOnPluginLoaded(1, plugin2_); @@ -209,14 +209,14 @@ TEST_F(PluginLoaderPosixTest, ThreeSuccessfulLoadsThenCrash) { EXPECT_EQ(2u, plugins.size()); EXPECT_EQ(plugin2_.name, plugins[1].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); plugin_loader()->TestOnPluginLoaded(2, plugin3_); EXPECT_EQ(3u, plugins.size()); EXPECT_EQ(plugin3_.name, plugins[2].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(1, did_callback); plugin_loader()->OnProcessCrashed(42); @@ -230,7 +230,7 @@ TEST_F(PluginLoaderPosixTest, TwoFailures) { plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(1); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); AddThreePlugins(); @@ -243,7 +243,7 @@ TEST_F(PluginLoaderPosixTest, TwoFailures) { EXPECT_EQ(1u, plugin_loader()->next_load_index()); EXPECT_EQ(0u, plugins.size()); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); plugin_loader()->TestOnPluginLoaded(1, plugin2_); @@ -251,13 +251,13 @@ TEST_F(PluginLoaderPosixTest, TwoFailures) { EXPECT_EQ(1u, plugins.size()); EXPECT_EQ(plugin2_.name, plugins[0].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); plugin_loader()->TestOnPluginLoadFailed(2, plugin3_.path); EXPECT_EQ(1u, plugins.size()); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(1, did_callback); } @@ -269,7 +269,7 @@ TEST_F(PluginLoaderPosixTest, CrashedProcess) { plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(1); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); AddThreePlugins(); @@ -283,7 +283,7 @@ TEST_F(PluginLoaderPosixTest, CrashedProcess) { EXPECT_EQ(1u, plugins.size()); EXPECT_EQ(plugin1_.name, plugins[0].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(1); @@ -302,7 +302,7 @@ TEST_F(PluginLoaderPosixTest, InternalPlugin) { plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(1); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); plugin2_.path = FilePath("/internal/plugin.plugin"); @@ -321,7 +321,7 @@ TEST_F(PluginLoaderPosixTest, InternalPlugin) { EXPECT_EQ(1u, plugins.size()); EXPECT_EQ(plugin1_.name, plugins[0].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); // Internal plugins can fail to load if they're built-in with manual @@ -332,14 +332,14 @@ TEST_F(PluginLoaderPosixTest, InternalPlugin) { EXPECT_EQ(plugin2_.name, plugins[1].name); EXPECT_EQ(0u, plugin_loader()->internal_plugins()->size()); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(0, did_callback); plugin_loader()->TestOnPluginLoaded(2, plugin3_); EXPECT_EQ(3u, plugins.size()); EXPECT_EQ(plugin3_.name, plugins[2].name); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(1, did_callback); } @@ -352,7 +352,7 @@ TEST_F(PluginLoaderPosixTest, AllCrashed) { // Spin the loop so that the canonical list of plugins can be set. EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(1); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); AddThreePlugins(); EXPECT_EQ(0u, plugin_loader()->next_load_index()); @@ -370,7 +370,7 @@ TEST_F(PluginLoaderPosixTest, AllCrashed) { plugin_loader()->OnProcessCrashed(42); plugin_loader()->OnProcessCrashed(42); - message_loop()->RunAllPending(); + message_loop()->RunUntilIdle(); EXPECT_EQ(1, did_callback); EXPECT_EQ(0u, plugin_loader()->loaded_plugins().size()); diff --git a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc index 3b8078e..1f50184 100644 --- a/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc +++ b/content/browser/renderer_host/media/audio_input_device_manager_unittest.cc @@ -106,7 +106,7 @@ class AudioInputDeviceManagerTest : public testing::Test { .Times(1); // Wait until we get the list. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } virtual void TearDown() OVERRIDE { @@ -149,7 +149,7 @@ TEST_F(AudioInputDeviceManagerTest, OpenAndCloseDevice) { .Times(1); // Waits for the callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } } @@ -179,7 +179,7 @@ TEST_F(AudioInputDeviceManagerTest, OpenMultipleDevices) { .Times(1); // Waits for the callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } // Checks if the session_ids are unique. @@ -197,7 +197,7 @@ TEST_F(AudioInputDeviceManagerTest, OpenMultipleDevices) { .Times(1); // Waits for the callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } } @@ -218,7 +218,7 @@ TEST_F(AudioInputDeviceManagerTest, OpenNotExistingDevice) { .Times(1); // Waits for the callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } // Opens default device twice. @@ -254,7 +254,7 @@ TEST_F(AudioInputDeviceManagerTest, OpenDeviceTwice) { .Times(1); // Waits for the callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } // Starts and closes the sessions after opening the devices. @@ -286,20 +286,20 @@ TEST_F(AudioInputDeviceManagerTest, StartAndStopSession) { EXPECT_CALL(*audio_input_listener_, Opened(MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index])) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); manager_->Start(session_id[index], audio_input_event_handler.get()); EXPECT_CALL(*audio_input_event_handler, DeviceStarted(session_id[index], iter->device_id)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); manager_->Stop(session_id[index]); manager_->Close(session_id[index]); EXPECT_CALL(*audio_input_listener_, Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index])) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } } @@ -331,13 +331,13 @@ TEST_F(AudioInputDeviceManagerTest, CloseWithoutStopSession) { EXPECT_CALL(*audio_input_listener_, Opened(MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index])) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); manager_->Start(session_id[index], audio_input_event_handler.get()); EXPECT_CALL(*audio_input_event_handler, DeviceStarted(session_id[index], iter->device_id)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); // Event Handler should get a stop device notification as no stop is called // before closing the device. @@ -348,7 +348,7 @@ TEST_F(AudioInputDeviceManagerTest, CloseWithoutStopSession) { EXPECT_CALL(*audio_input_listener_, Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id[index])) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } } @@ -381,7 +381,7 @@ TEST_F(AudioInputDeviceManagerTest, StartDeviceTwice) { EXPECT_CALL(*audio_input_listener_, Opened(MEDIA_DEVICE_AUDIO_CAPTURE, second_session_id)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); // Calls Start()/Stop()/Close() for the default device twice. manager_->Start(first_session_id, first_event_handler.get()); @@ -394,7 +394,7 @@ TEST_F(AudioInputDeviceManagerTest, StartDeviceTwice) { DeviceStarted(second_session_id, media::AudioManagerBase::kDefaultDeviceId)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); manager_->Stop(first_session_id); manager_->Stop(second_session_id); @@ -406,7 +406,7 @@ TEST_F(AudioInputDeviceManagerTest, StartDeviceTwice) { EXPECT_CALL(*audio_input_listener_, Closed(MEDIA_DEVICE_AUDIO_CAPTURE, second_session_id)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } // Starts an invalid session. @@ -427,7 +427,7 @@ TEST_F(AudioInputDeviceManagerTest, StartInvalidSession) { EXPECT_CALL(*audio_input_listener_, Opened(MEDIA_DEVICE_AUDIO_CAPTURE, session_id)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); // Starts a non-opened device. // This should fail and trigger error code 'kDeviceNotAvailable'. @@ -436,13 +436,13 @@ TEST_F(AudioInputDeviceManagerTest, StartInvalidSession) { EXPECT_CALL(*audio_input_event_handler, DeviceStarted(invalid_session_id, std::string())) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); manager_->Close(session_id); EXPECT_CALL(*audio_input_listener_, Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } // Starts a session twice, the first time should succeed, while the second @@ -464,7 +464,7 @@ TEST_F(AudioInputDeviceManagerTest, StartSessionTwice) { EXPECT_CALL(*audio_input_listener_, Opened(MEDIA_DEVICE_AUDIO_CAPTURE, session_id)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); // Starts the session, it should succeed. manager_->Start(session_id, audio_input_event_handler.get()); @@ -472,7 +472,7 @@ TEST_F(AudioInputDeviceManagerTest, StartSessionTwice) { DeviceStarted(session_id, media::AudioManagerBase::kDefaultDeviceId)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); // Starts the session for the second time, it should fail. manager_->Start(session_id, audio_input_event_handler.get()); @@ -485,7 +485,7 @@ TEST_F(AudioInputDeviceManagerTest, StartSessionTwice) { EXPECT_CALL(*audio_input_listener_, Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id)) .Times(1); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } } // namespace content diff --git a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc index 8b9b568..e8bd79c 100644 --- a/content/browser/renderer_host/media/audio_renderer_host_unittest.cc +++ b/content/browser/renderer_host/media/audio_renderer_host_unittest.cc @@ -217,7 +217,7 @@ class AudioRendererHostTest : public testing::Test { // Send a message to AudioRendererHost to tell it we want to close the // stream. host_->OnCloseStream(kStreamId); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } void Play() { @@ -245,7 +245,7 @@ class AudioRendererHostTest : public testing::Test { OnSetAudioStreamVolume(_, kStreamId, volume)); host_->OnSetVolume(kStreamId, volume); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } void SimulateError() { diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index 88ee346..d50462f 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc @@ -163,7 +163,7 @@ class MediaStreamDispatcherHostTest : public testing::Test { } virtual void TearDown() OVERRIDE { - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); // Recover the old browser client and content client. GetContentClient()->set_browser_for_testing(old_browser_client_); diff --git a/content/browser/renderer_host/media/media_stream_manager_unittest.cc b/content/browser/renderer_host/media/media_stream_manager_unittest.cc index 4f9d338..03b8229 100644 --- a/content/browser/renderer_host/media/media_stream_manager_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_manager_unittest.cc @@ -89,7 +89,7 @@ class MediaStreamManagerTest : public ::testing::Test { } virtual void TearDown() { - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); // Delete the IO message loop to clean up the MediaStreamManager. message_loop_.reset(); diff --git a/content/browser/renderer_host/media/media_stream_ui_controller_unittest.cc b/content/browser/renderer_host/media/media_stream_ui_controller_unittest.cc index 89a0c6e..641c69c 100644 --- a/content/browser/renderer_host/media/media_stream_ui_controller_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_ui_controller_unittest.cc @@ -40,7 +40,7 @@ class MediaStreamDeviceUIControllerTest } virtual void TearDown() { - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } void CreateDummyRequest(const std::string& label, bool audio, bool video) { diff --git a/content/browser/renderer_host/media/video_capture_host_unittest.cc b/content/browser/renderer_host/media/video_capture_host_unittest.cc index f5c2f65..71fcfcf 100644 --- a/content/browser/renderer_host/media/video_capture_host_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_host_unittest.cc @@ -237,7 +237,7 @@ class VideoCaptureHostTest : public testing::Test { host_ = NULL; // We need to continue running message_loop_ to complete all destructions. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); // Delete the IO message loop. This will cause the MediaStreamManager to be // notified so it will stop its device thread and device managers. @@ -332,7 +332,7 @@ class VideoCaptureHostTest : public testing::Test { VideoCaptureControllerID id(kDeviceId); host_->OnError(id); // Wait for the error callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } scoped_refptr<MockVideoCaptureHost> host_; diff --git a/content/browser/renderer_host/media/video_capture_manager_unittest.cc b/content/browser/renderer_host/media/video_capture_manager_unittest.cc index 85cd94a..65f84c7 100644 --- a/content/browser/renderer_host/media/video_capture_manager_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_manager_unittest.cc @@ -106,7 +106,7 @@ TEST_F(VideoCaptureManagerTest, CreateAndClose) { vcm_->EnumerateDevices(); // Wait to get device callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); int video_session_id = vcm_->Open(listener_->devices_.front()); @@ -121,7 +121,7 @@ TEST_F(VideoCaptureManagerTest, CreateAndClose) { vcm_->Close(video_session_id); // Wait to check callbacks before removing the listener. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); vcm_->Unregister(); } @@ -135,7 +135,7 @@ TEST_F(VideoCaptureManagerTest, OpenTwice) { vcm_->EnumerateDevices(); // Wait to get device callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); int video_session_id_first = vcm_->Open(listener_->devices_.front()); @@ -148,7 +148,7 @@ TEST_F(VideoCaptureManagerTest, OpenTwice) { vcm_->Close(video_session_id_second); // Wait to check callbacks before removing the listener. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); vcm_->Unregister(); } @@ -162,7 +162,7 @@ TEST_F(VideoCaptureManagerTest, OpenTwo) { vcm_->EnumerateDevices(); // Wait to get device callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); StreamDeviceInfoArray::iterator it = listener_->devices_.begin(); @@ -174,7 +174,7 @@ TEST_F(VideoCaptureManagerTest, OpenTwo) { vcm_->Close(video_session_id_second); // Wait to check callbacks before removing the listener. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); vcm_->Unregister(); } @@ -190,7 +190,7 @@ TEST_F(VideoCaptureManagerTest, OpenNotExisting) { vcm_->EnumerateDevices(); // Wait to get device callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); MediaStreamType stream_type = MEDIA_DEVICE_VIDEO_CAPTURE; std::string device_name("device_doesnt_exist"); @@ -201,7 +201,7 @@ TEST_F(VideoCaptureManagerTest, OpenNotExisting) { vcm_->Open(dummy_device); // Wait to check callbacks before removing the listener. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); vcm_->Unregister(); } @@ -224,7 +224,7 @@ TEST_F(VideoCaptureManagerTest, StartUsingId) { vcm_->Stop(VideoCaptureManager::kStartOpenSessionId, base::Closure()); // Wait to check callbacks before removing the listener. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); vcm_->Unregister(); } @@ -238,7 +238,7 @@ TEST_F(VideoCaptureManagerTest, CloseWithoutStop) { vcm_->EnumerateDevices(); // Wait to get device callback. - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); int video_session_id = vcm_->Open(listener_->devices_.front()); @@ -255,7 +255,7 @@ TEST_F(VideoCaptureManagerTest, CloseWithoutStop) { vcm_->Stop(video_session_id, base::Closure()); // Wait to check callbacks before removing the listener - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); vcm_->Unregister(); } diff --git a/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc b/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc index 8e8afe7..f86efc5 100644 --- a/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc +++ b/content/browser/renderer_host/media/web_contents_video_capture_device_unittest.cc @@ -178,14 +178,14 @@ class WebContentsVideoCaptureDeviceTest : public testing::Test { device_->DeAllocate(); // Guarantees no more use of consumer_. consumer_.reset(); device_.reset(); // Release reference to internal CaptureMachine. - message_loop_->RunAllPending(); // Just in case. + message_loop_->RunUntilIdle(); // Just in case. destroyed_->Wait(); // Wait until CaptureMachine is fully destroyed. destroyed_.reset(); source_.reset(); browser_context_.reset(); ui_thread_->Stop(); ui_thread_.reset(); - message_loop_->RunAllPending(); // Deletes MockRenderProcessHost. + message_loop_->RunUntilIdle(); // Deletes MockRenderProcessHost. message_loop_.reset(); } diff --git a/content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc b/content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc index da4e448..7d0124a 100644 --- a/content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc +++ b/content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc @@ -153,7 +153,7 @@ TEST_F(PepperGamepadHostTest, WaitForReply) { fetcher->WaitForDataRead(); // It should not have sent the callback message. - service_->message_loop().RunAllPending(); + service_->message_loop().RunUntilIdle(); EXPECT_EQ(0u, sink().message_count()); // Set a button down and wait for it to be read twice. @@ -170,7 +170,7 @@ TEST_F(PepperGamepadHostTest, WaitForReply) { fetcher->WaitForDataRead(); // It should have sent a callback. - service_->message_loop().RunAllPending(); + service_->message_loop().RunUntilIdle(); ppapi::proxy::ResourceMessageReplyParams reply_params; IPC::Message reply_msg; ASSERT_TRUE(sink().GetFirstResourceReplyMatching( diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc index b302c38..098556d 100644 --- a/content/browser/renderer_host/render_widget_host_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_unittest.cc @@ -408,7 +408,7 @@ class RenderWidgetHostTest : public testing::Test { #endif // Process all pending tasks to avoid leaks. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } void SendInputEventACK(WebInputEvent::Type type, bool processed) { @@ -932,7 +932,7 @@ TEST_F(RenderWidgetHostTest, CoalescesWheelEvents) { // The coalesced events can queue up a delayed ack // so that additional input events can be processed before // we turn off coalescing. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1U, process_->sink().message_count()); EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( ViewMsg_HandleInputEvent::ID)); @@ -940,7 +940,7 @@ TEST_F(RenderWidgetHostTest, CoalescesWheelEvents) { // One more time. SendInputEventACK(WebInputEvent::MouseWheel, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1U, process_->sink().message_count()); EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( ViewMsg_HandleInputEvent::ID)); @@ -948,7 +948,7 @@ TEST_F(RenderWidgetHostTest, CoalescesWheelEvents) { // After the final ack, the queue should be empty. SendInputEventACK(WebInputEvent::MouseWheel, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0U, process_->sink().message_count()); } @@ -999,7 +999,7 @@ TEST_F(RenderWidgetHostTest, CoalescesGesturesEvents) { // Check that the ACK sends the second message. SendInputEventACK(WebInputEvent::GestureScrollBegin, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1U, process_->sink().message_count()); EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( ViewMsg_HandleInputEvent::ID)); @@ -1007,7 +1007,7 @@ TEST_F(RenderWidgetHostTest, CoalescesGesturesEvents) { // Ack for queued coalesced event. SendInputEventACK(WebInputEvent::GestureScrollUpdate, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1U, process_->sink().message_count()); EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( ViewMsg_HandleInputEvent::ID)); @@ -1015,7 +1015,7 @@ TEST_F(RenderWidgetHostTest, CoalescesGesturesEvents) { // Ack for queued uncoalesced event. SendInputEventACK(WebInputEvent::GestureScrollUpdate, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1U, process_->sink().message_count()); EXPECT_TRUE(process_->sink().GetUniqueMessageMatching( ViewMsg_HandleInputEvent::ID)); @@ -1023,7 +1023,7 @@ TEST_F(RenderWidgetHostTest, CoalescesGesturesEvents) { // After the final ack, the queue should be empty. SendInputEventACK(WebInputEvent::GestureScrollEnd, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0U, process_->sink().message_count()); } @@ -1041,12 +1041,12 @@ TEST_F(RenderWidgetHostTest, GestureFlingCancelsFiltered) { SimulateGestureFlingStartEvent(0, -10); EXPECT_TRUE(host_->FlingInProgress()); SendInputEventACK(WebInputEvent::GestureFlingStart, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); SimulateGestureEvent(WebInputEvent::GestureFlingCancel); EXPECT_FALSE(host_->FlingInProgress()); EXPECT_EQ(2U, process_->sink().message_count()); SendInputEventACK(WebInputEvent::GestureFlingCancel, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); // GFC before previous GFS is acked. @@ -1060,9 +1060,9 @@ TEST_F(RenderWidgetHostTest, GestureFlingCancelsFiltered) { // Advance state realistically. SendInputEventACK(WebInputEvent::GestureFlingStart, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); SendInputEventACK(WebInputEvent::GestureFlingCancel, true); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0U, host_->GestureEventLastQueueEventSize()); // GFS is added to the queue if another event is pending diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 7aecc40..d0b877d 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc @@ -87,7 +87,7 @@ class RenderWidgetHostViewAuraTest : public testing::Test { aura_test_helper_->TearDown(); message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } protected: diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index f94d30a..b79fda9 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm @@ -106,7 +106,7 @@ class RenderWidgetHostViewMacTest : public RenderViewHostImplTestHarness { // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. rwhv_cocoa_.reset(); pool_.Recycle(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); pool_.Recycle(); // See comment in SetUp(). diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc index 49f95ff..513e140 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -110,7 +110,7 @@ static ResourceHostMsg_Request CreateResourceRequest( // Spin up the message loop to kick off the request. static void KickOffRequest() { - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } // We may want to move this to a shared space if it is useful for something else @@ -528,7 +528,7 @@ class ResourceDispatcherHostTest : public testing::Test, send_data_received_acks_(false) { browser_context_.reset(new TestBrowserContext()); BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); filter_ = new ForwardingFilter( this, browser_context_->GetResourceContext()); } @@ -581,7 +581,7 @@ class ResourceDispatcherHostTest : public testing::Test, ResourceDispatcherHostImpl::Get()->CancelRequestsForContext( browser_context_->GetResourceContext()); browser_context_.reset(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } // Creates a request using the current test object as the filter. @@ -860,7 +860,7 @@ TEST_F(ResourceDispatcherHostTest, Cancel) { // flush all the pending requests while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0)); @@ -900,7 +900,7 @@ TEST_F(ResourceDispatcherHostTest, CancelWhileStartIsDeferred) { // flush all the pending requests while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(was_deleted); @@ -918,7 +918,7 @@ TEST_F(ResourceDispatcherHostTest, CancelInResourceThrottleWillStartRequest) { // flush all the pending requests while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); ResourceIPCAccumulator::ClassifiedMessages msgs; accum_.GetClassifiedMessages(&msgs); @@ -945,7 +945,7 @@ TEST_F(ResourceDispatcherHostTest, PausedStartError) { // flush all the pending requests while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, host_.pending_requests()); } @@ -974,7 +974,7 @@ TEST_F(ResourceDispatcherHostTest, ThrottleAndResumeTwice) { ASSERT_FALSE(GenericResourceThrottle::active_throttle()); // The request is started asynchronously. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Flush all the pending requests. while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} @@ -1004,7 +1004,7 @@ TEST_F(ResourceDispatcherHostTest, CancelInDelegate) { // flush all the pending requests while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0)); @@ -1075,7 +1075,7 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancel) { // Make sure all requests have finished stage one. test_url_1 will have // finished. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // TODO(mbelshe): // Now that the async IO path is in place, the IO always completes on the @@ -1376,7 +1376,7 @@ TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) { // Flush all the pending requests. while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(filter_->child_id())); @@ -1756,7 +1756,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigation) { new_render_view_id, new_request_id, request); bool msg_was_ok; host_.OnMessageReceived(transfer_request_msg, second_filter, &msg_was_ok); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Flush all the pending requests. while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} @@ -1817,7 +1817,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationAndThenRedirect) { new_render_view_id, new_request_id, request); bool msg_was_ok; host_.OnMessageReceived(transfer_request_msg, second_filter, &msg_was_ok); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Response data for "http://other.com/blerg": const std::string kResponseBody = "hello world"; @@ -1828,7 +1828,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationAndThenRedirect) { // OK, let the redirect happen. SetDelayedStartJobGeneration(false); CompleteStartRequest(second_filter, new_request_id); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Flush all the pending requests. while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} @@ -1837,7 +1837,7 @@ TEST_F(ResourceDispatcherHostTest, TransferNavigationAndThenRedirect) { ResourceHostMsg_FollowRedirect redirect_msg( new_render_view_id, new_request_id, false, GURL()); host_.OnMessageReceived(redirect_msg, second_filter, &msg_was_ok); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Flush all the pending requests. while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} @@ -1946,7 +1946,7 @@ TEST_F(ResourceDispatcherHostTest, DelayedDataReceivedACKs) { host_.OnMessageReceived(msg, filter_.get(), &msg_was_ok); } - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); msgs.clear(); accum_.GetClassifiedMessages(&msgs); diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc index 9a40bd2..55fd82a 100644 --- a/content/browser/site_instance_impl_unittest.cc +++ b/content/browser/site_instance_impl_unittest.cc @@ -143,8 +143,8 @@ class SiteInstanceTest : public testing::Test { // We don't just do this in TearDown() because we create TestBrowserContext // objects in each test, which will be destructed before // TearDown() is called. - MessageLoop::current()->RunAllPending(); - message_loop_.RunAllPending(); + MessageLoop::current()->RunUntilIdle(); + message_loop_.RunUntilIdle(); } private: diff --git a/content/browser/speech/speech_recognizer_unittest.cc b/content/browser/speech/speech_recognizer_unittest.cc index 2741767..a697ab4 100644 --- a/content/browser/speech/speech_recognizer_unittest.cc +++ b/content/browser/speech/speech_recognizer_unittest.cc @@ -185,7 +185,7 @@ TEST_F(SpeechRecognizerTest, StopNoData) { // Check for callbacks when stopping record before any audio gets recorded. recognizer_->StartRecognition(); recognizer_->StopAudioCapture(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_started_); EXPECT_FALSE(audio_started_); EXPECT_FALSE(result_received_); @@ -198,7 +198,7 @@ TEST_F(SpeechRecognizerTest, CancelNoData) { // recorded. recognizer_->StartRecognition(); recognizer_->AbortRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_started_); EXPECT_FALSE(audio_started_); EXPECT_FALSE(result_received_); @@ -210,7 +210,7 @@ TEST_F(SpeechRecognizerTest, StopWithData) { // Start recording, give some data and then stop. This should wait for the // network callback to arrive before completion. recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); @@ -223,14 +223,14 @@ TEST_F(SpeechRecognizerTest, StopWithData) { for (size_t i = 0; i < kNumChunks; ++i) { controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); ASSERT_TRUE(fetcher); EXPECT_EQ(i + 1, fetcher->upload_chunks().size()); } recognizer_->StopAudioCapture(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(audio_started_); EXPECT_TRUE(audio_ended_); EXPECT_FALSE(recognition_ended_); @@ -249,7 +249,7 @@ TEST_F(SpeechRecognizerTest, StopWithData) { fetcher->SetResponseString( "{\"status\":0,\"hypotheses\":[{\"utterance\":\"123\"}]}"); fetcher->delegate()->OnURLFetchComplete(fetcher); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_ended_); EXPECT_TRUE(result_received_); EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); @@ -259,15 +259,15 @@ TEST_F(SpeechRecognizerTest, StopWithData) { TEST_F(SpeechRecognizerTest, CancelWithData) { // Start recording, give some data and then cancel. recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); recognizer_->AbortRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); ASSERT_TRUE(url_fetcher_factory_.GetFetcherByID(0)); EXPECT_TRUE(recognition_started_); EXPECT_TRUE(audio_started_); @@ -280,18 +280,18 @@ TEST_F(SpeechRecognizerTest, ConnectionError) { // Start recording, give some data and then stop. Issue the network callback // with a connection error and verify that the recognizer bubbles the error up recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); ASSERT_TRUE(fetcher); recognizer_->StopAudioCapture(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(audio_started_); EXPECT_TRUE(audio_ended_); EXPECT_FALSE(recognition_ended_); @@ -307,7 +307,7 @@ TEST_F(SpeechRecognizerTest, ConnectionError) { fetcher->set_response_code(0); fetcher->SetResponseString(""); fetcher->delegate()->OnURLFetchComplete(fetcher); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_ended_); EXPECT_FALSE(result_received_); EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NETWORK, error_); @@ -318,18 +318,18 @@ TEST_F(SpeechRecognizerTest, ServerError) { // Start recording, give some data and then stop. Issue the network callback // with a 500 error and verify that the recognizer bubbles the error up recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); ASSERT_TRUE(fetcher); recognizer_->StopAudioCapture(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(audio_started_); EXPECT_TRUE(audio_ended_); EXPECT_FALSE(recognition_ended_); @@ -344,7 +344,7 @@ TEST_F(SpeechRecognizerTest, ServerError) { fetcher->set_response_code(500); fetcher->SetResponseString("Internal Server Error"); fetcher->delegate()->OnURLFetchComplete(fetcher); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_ended_); EXPECT_FALSE(result_received_); EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NETWORK, error_); @@ -354,12 +354,12 @@ TEST_F(SpeechRecognizerTest, ServerError) { TEST_F(SpeechRecognizerTest, AudioControllerErrorNoData) { // Check if things tear down properly if AudioInputController threw an error. recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); controller->event_handler()->OnError(controller, 0); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_started_); EXPECT_FALSE(audio_started_); EXPECT_FALSE(result_received_); @@ -371,14 +371,14 @@ TEST_F(SpeechRecognizerTest, AudioControllerErrorWithData) { // Check if things tear down properly if AudioInputController threw an error // after giving some audio data. recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); controller->event_handler()->OnError(controller, 0); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); ASSERT_TRUE(url_fetcher_factory_.GetFetcherByID(0)); EXPECT_TRUE(recognition_started_); EXPECT_TRUE(audio_started_); @@ -391,7 +391,7 @@ TEST_F(SpeechRecognizerTest, NoSpeechCallbackIssued) { // Start recording and give a lot of packets with audio samples set to zero. // This should trigger the no-speech detector and issue a callback. recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); @@ -403,7 +403,7 @@ TEST_F(SpeechRecognizerTest, NoSpeechCallbackIssued) { controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); } - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(recognition_started_); EXPECT_TRUE(audio_started_); EXPECT_FALSE(result_received_); @@ -417,7 +417,7 @@ TEST_F(SpeechRecognizerTest, NoSpeechCallbackNotIssued) { // treated as normal speech input and the no-speech detector should not get // triggered. recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); @@ -439,13 +439,13 @@ TEST_F(SpeechRecognizerTest, NoSpeechCallbackNotIssued) { audio_packet_.size()); } - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(SPEECH_RECOGNITION_ERROR_NONE, error_); EXPECT_TRUE(audio_started_); EXPECT_FALSE(audio_ended_); EXPECT_FALSE(recognition_ended_); recognizer_->AbortRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); CheckFinalEventsConsistency(); } @@ -455,7 +455,7 @@ TEST_F(SpeechRecognizerTest, SetInputVolumeCallback) { // get the callback during estimation phase, then get zero for the silence // samples and proper volume for the loud audio. recognizer_->StartRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); TestAudioInputController* controller = audio_input_controller_factory_.controller(); ASSERT_TRUE(controller); @@ -470,19 +470,19 @@ TEST_F(SpeechRecognizerTest, SetInputVolumeCallback) { controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); } - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(-1.0f, volume_); // No audio volume set yet. // The vector is already filled with zero value samples on create. controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_FLOAT_EQ(0.74939233f, volume_); FillPacketWithTestWaveform(); controller->event_handler()->OnData(controller, &audio_packet_[0], audio_packet_.size()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_FLOAT_EQ(0.89926866f, volume_); EXPECT_FLOAT_EQ(0.75071919f, noise_volume_); @@ -490,7 +490,7 @@ TEST_F(SpeechRecognizerTest, SetInputVolumeCallback) { EXPECT_FALSE(audio_ended_); EXPECT_FALSE(recognition_ended_); recognizer_->AbortRecognition(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); CheckFinalEventsConsistency(); } diff --git a/content/browser/system_message_window_win_unittest.cc b/content/browser/system_message_window_win_unittest.cc index 5053fa5..0fa5109 100644 --- a/content/browser/system_message_window_win_unittest.cc +++ b/content/browser/system_message_window_win_unittest.cc @@ -34,12 +34,12 @@ class SystemMessageWindowWinTest : public testing::Test { TEST_F(SystemMessageWindowWinTest, DevicesChanged) { EXPECT_CALL(observer_, OnDevicesChanged(testing::_)).Times(1); window_.OnDeviceChange(DBT_DEVNODES_CHANGED, NULL); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } TEST_F(SystemMessageWindowWinTest, RandomMessage) { window_.OnDeviceChange(DBT_DEVICEQUERYREMOVE, NULL); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } } // namespace content diff --git a/content/common/resource_dispatcher_unittest.cc b/content/common/resource_dispatcher_unittest.cc index 36aea72..f5c226b 100644 --- a/content/common/resource_dispatcher_unittest.cc +++ b/content/common/resource_dispatcher_unittest.cc @@ -337,7 +337,7 @@ TEST_F(DeferredResourceLoadingTest, DeferredLoadTest) { InitMessages(); // Dispatch deferred messages. - message_loop.RunAllPending(); + message_loop.RunUntilIdle(); delete bridge; } diff --git a/content/public/test/render_view_fake_resources_test.cc b/content/public/test/render_view_fake_resources_test.cc index 0c0a282..136cc25 100644 --- a/content/public/test/render_view_fake_resources_test.cc +++ b/content/public/test/render_view_fake_resources_test.cc @@ -94,7 +94,7 @@ void RenderViewFakeResourcesTest::TearDown() { ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId))); do { - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); view_ = NULL; RenderView::ForEach(this); } while (view_); diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc index 4d25621..62d4833 100644 --- a/content/public/test/render_view_test.cc +++ b/content/public/test/render_view_test.cc @@ -192,7 +192,7 @@ void RenderViewTest::TearDown() { // After telling the view to close and resetting mock_process_ we may get // some new tasks which need to be processed before shutting down WebKit // (http://crbug.com/21508). - msg_loop_.RunAllPending(); + msg_loop_.RunUntilIdle(); WebKit::shutdown(); diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc index cf0e0ec..09b17fa 100644 --- a/content/public/test/test_renderer_host.cc +++ b/content/public/test/test_renderer_host.cc @@ -163,7 +163,7 @@ void RenderViewHostTestHarness::TearDown() { #endif // Make sure that we flush any messages related to WebContentsImpl destruction // before we destroy the browser context. - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Delete any RenderProcessHosts before the BrowserContext goes away. if (rvh_test_enabler_.rph_factory_.get()) @@ -171,7 +171,7 @@ void RenderViewHostTestHarness::TearDown() { // Release the browser context on the UI thread. message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); #if defined(OS_WIN) ole_initializer_.reset(); diff --git a/content/renderer/gpu/input_event_filter_unittest.cc b/content/renderer/gpu/input_event_filter_unittest.cc index 685fbf5..aa65372 100644 --- a/content/renderer/gpu/input_event_filter_unittest.cc +++ b/content/renderer/gpu/input_event_filter_unittest.cc @@ -113,7 +113,7 @@ void AddEventsToFilter(IPC::ChannelProxy::MessageFilter* message_filter, message_filter->OnMessageReceived(message); } - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } } // namespace diff --git a/content/renderer/media/audio_message_filter_unittest.cc b/content/renderer/media/audio_message_filter_unittest.cc index f5eb3a6..0125e73 100644 --- a/content/renderer/media/audio_message_filter_unittest.cc +++ b/content/renderer/media/audio_message_filter_unittest.cc @@ -102,7 +102,7 @@ TEST(AudioMessageFilterTest, Basic) { EXPECT_EQ(media::AudioOutputIPCDelegate::kPlaying, delegate.state()); delegate.Reset(); - message_loop.RunAllPending(); + message_loop.RunUntilIdle(); filter->RemoveDelegate(stream_id); } @@ -136,7 +136,7 @@ TEST(AudioMessageFilterTest, Delegates) { EXPECT_TRUE(delegate2.state_changed_received()); delegate2.Reset(); - message_loop.RunAllPending(); + message_loop.RunUntilIdle(); filter->RemoveDelegate(stream_id1); filter->RemoveDelegate(stream_id2); diff --git a/content/renderer/media/rtc_video_decoder_unittest.cc b/content/renderer/media/rtc_video_decoder_unittest.cc index ab54037..d8062a2 100644 --- a/content/renderer/media/rtc_video_decoder_unittest.cc +++ b/content/renderer/media/rtc_video_decoder_unittest.cc @@ -210,14 +210,14 @@ class RTCVideoDecoderTest : public testing::Test { // Test successful initialization. decoder_->Initialize( NULL, NewExpectedStatusCB(PIPELINE_OK), NewStatisticsCB()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } void Stop() { EXPECT_CALL(*video_track_, RemoveRenderer(decoder_.get())); decoder_->Stop(media::NewExpectedClosure()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_EQ(RTCVideoDecoder::kStopped, decoder_->state_); } @@ -286,7 +286,7 @@ TEST_F(RTCVideoDecoderTest, DoReset) { decoder_->Read(read_cb_); decoder_->Reset(media::NewExpectedClosure()); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_); } @@ -296,7 +296,7 @@ TEST_F(RTCVideoDecoderTest, DoRenderFrame) { for (size_t i = 0; i < media::limits::kMaxVideoFrames; ++i) RenderFrame(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); EXPECT_EQ(RTCVideoDecoder::kNormal, decoder_->state_); } @@ -307,7 +307,7 @@ TEST_F(RTCVideoDecoderTest, DoSetSize) { HasSize(kWidth, kHeight))); decoder_->Read(read_cb_); RenderFrame(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); int new_width = kWidth * 2; int new_height = kHeight * 2; @@ -317,7 +317,7 @@ TEST_F(RTCVideoDecoderTest, DoSetSize) { HasSize(new_width, new_height))); decoder_->Read(read_cb_); RenderFrame(); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } TEST_F(RTCVideoDecoderTest, ReadAndShutdown) { @@ -334,7 +334,7 @@ TEST_F(RTCVideoDecoderTest, ReadAndShutdown) { EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk, scoped_refptr<media::VideoFrame>())); decoder_->Read(read_cb_); - message_loop_.RunAllPending(); + message_loop_.RunUntilIdle(); } } // namespace content diff --git a/content/renderer/media/video_capture_impl_unittest.cc b/content/renderer/media/video_capture_impl_unittest.cc index 5a91278..545fc18 100644 --- a/content/renderer/media/video_capture_impl_unittest.cc +++ b/content/renderer/media/video_capture_impl_unittest.cc @@ -145,7 +145,7 @@ TEST_F(VideoCaptureImplTest, Simple) { .WillOnce(Return()); video_capture_impl_->StartCapture(client.get(), capability); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); EXPECT_CALL(*client, OnStopped(_)) .WillOnce(Return()); @@ -153,7 +153,7 @@ TEST_F(VideoCaptureImplTest, Simple) { .WillOnce(Return()); video_capture_impl_->StopCapture(client.get()); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } TEST_F(VideoCaptureImplTest, TwoClientsInSequence) { @@ -167,7 +167,7 @@ TEST_F(VideoCaptureImplTest, TwoClientsInSequence) { .WillOnce(Return()); video_capture_impl_->StartCapture(client.get(), capability); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); EXPECT_CALL(*client, OnStopped(_)) .WillOnce(Return()); @@ -175,7 +175,7 @@ TEST_F(VideoCaptureImplTest, TwoClientsInSequence) { .WillOnce(Return()); video_capture_impl_->StopCapture(client.get()); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); EXPECT_CALL(*client, OnStarted(_)) .WillOnce(Return()); @@ -183,7 +183,7 @@ TEST_F(VideoCaptureImplTest, TwoClientsInSequence) { .WillOnce(Return()); video_capture_impl_->StartCapture(client.get(), capability); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); EXPECT_CALL(*client, OnStopped(_)) .WillOnce(Return()); @@ -191,7 +191,7 @@ TEST_F(VideoCaptureImplTest, TwoClientsInSequence) { .WillOnce(Return()); video_capture_impl_->StopCapture(client.get()); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } TEST_F(VideoCaptureImplTest, LargeAndSmall) { @@ -213,7 +213,7 @@ TEST_F(VideoCaptureImplTest, LargeAndSmall) { video_capture_impl_->StartCapture(client_large.get(), capability_large); video_capture_impl_->StartCapture(client_small.get(), capability_small); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); EXPECT_CALL(*client_large, OnStopped(_)) .WillOnce(Return()); @@ -226,7 +226,7 @@ TEST_F(VideoCaptureImplTest, LargeAndSmall) { video_capture_impl_->StopCapture(client_large.get()); video_capture_impl_->StopCapture(client_small.get()); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } TEST_F(VideoCaptureImplTest, SmallAndLarge) { @@ -249,7 +249,7 @@ TEST_F(VideoCaptureImplTest, SmallAndLarge) { video_capture_impl_->StartCapture(client_small.get(), capability_small); video_capture_impl_->StartCapture(client_large.get(), capability_large); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); EXPECT_CALL(*client_large, OnStopped(_)) .WillOnce(Return()); @@ -262,7 +262,7 @@ TEST_F(VideoCaptureImplTest, SmallAndLarge) { video_capture_impl_->StopCapture(client_small.get()); video_capture_impl_->StopCapture(client_large.get()); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } TEST_F(VideoCaptureImplTest, TwoClientsWithSameSize) { @@ -283,7 +283,7 @@ TEST_F(VideoCaptureImplTest, TwoClientsWithSameSize) { video_capture_impl_->StartCapture(client1.get(), capability); video_capture_impl_->StartCapture(client2.get(), capability); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); EXPECT_CALL(*client1, OnStopped(_)) .WillOnce(Return()); @@ -296,7 +296,7 @@ TEST_F(VideoCaptureImplTest, TwoClientsWithSameSize) { video_capture_impl_->StopCapture(client1.get()); video_capture_impl_->StopCapture(client2.get()); - message_loop_->RunAllPending(); + message_loop_->RunUntilIdle(); } } // namespace content diff --git a/content/renderer/media/video_capture_message_filter_unittest.cc b/content/renderer/media/video_capture_message_filter_unittest.cc index 04ea6a2..4c6205b 100644 --- a/content/renderer/media/video_capture_message_filter_unittest.cc +++ b/content/renderer/media/video_capture_message_filter_unittest.cc @@ -164,7 +164,7 @@ TEST(VideoCaptureMessageFilterTest, Basic) { delegate.received_device_info().frame_per_second); delegate.Reset(); - message_loop.RunAllPending(); + message_loop.RunUntilIdle(); } TEST(VideoCaptureMessageFilterTest, Delegates) { @@ -214,7 +214,7 @@ TEST(VideoCaptureMessageFilterTest, Delegates) { VIDEO_CAPTURE_STATE_STARTED)); EXPECT_FALSE(delegate2.state_changed_received()); - message_loop.RunAllPending(); + message_loop.RunUntilIdle(); } } // namespace content diff --git a/content/shell/shell.cc b/content/shell/shell.cc index eaac653..e85d976 100644 --- a/content/shell/shell.cc +++ b/content/shell/shell.cc @@ -91,7 +91,7 @@ void Shell::CloseAllWindows() { std::vector<Shell*> open_windows(windows_); for (size_t i = 0; i < open_windows.size(); ++i) open_windows[i]->Close(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } void Shell::SetShellCreatedCallback( diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc index 0e6841f..a9eb055 100644 --- a/content/test/content_browser_test.cc +++ b/content/test/content_browser_test.cc @@ -109,7 +109,7 @@ void ContentBrowserTest::RunTestOnMainThreadLoop() { #endif // Pump startup related events. - MessageLoopForUI::current()->RunAllPending(); + MessageLoopForUI::current()->RunUntilIdle(); #if defined(OS_MACOSX) pool.Recycle(); diff --git a/content/test/webrtc_audio_device_test.cc b/content/test/webrtc_audio_device_test.cc index 6eb6cec..ba01e1a 100644 --- a/content/test/webrtc_audio_device_test.cc +++ b/content/test/webrtc_audio_device_test.cc @@ -154,7 +154,7 @@ void WebRTCAudioDeviceTest::TearDown() { SetAudioUtilCallback(NULL); // Run any pending cleanup tasks that may have been posted to the main thread. - ChildProcess::current()->main_thread()->message_loop()->RunAllPending(); + ChildProcess::current()->main_thread()->message_loop()->RunUntilIdle(); // Kick of the cleanup process by closing the channel. This queues up // OnStreamClosed calls to be executed on the audio thread. |