Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc

Issue 14197014: Add TestBrowserThreadBundle into RenderViewHostTestHarness. Kill some unnecessary real threads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged ToT Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
index ad4ad6b43d32a82974242e5c33d30c45a211f7ef..17f4ba332e3d5cbe01f5118fff5c9b80cf83f82b 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc
@@ -29,7 +29,7 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/features/feature.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
using content::BrowserThread;
@@ -79,10 +79,11 @@ class FakeLauncher : public NativeProcessLauncher {
class NativeMessagingTest : public ::testing::Test,
public NativeMessageProcessHost::Client,
public base::SupportsWeakPtr<NativeMessagingTest> {
- public:
+ protected:
NativeMessagingTest()
: current_channel_(chrome::VersionInfo::CHANNEL_DEV),
- native_message_process_host_(NULL) {
+ native_message_process_host_(NULL),
+ thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {
}
virtual void SetUp() OVERRIDE {
@@ -91,10 +92,6 @@ class NativeMessagingTest : public ::testing::Test,
// directory.
ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_));
ASSERT_TRUE(PathService::Override(chrome::DIR_USER_DATA, GetTestDir()));
- ui_thread_.reset(new content::TestBrowserThread(BrowserThread::UI,
- &message_loop_));
- io_thread_.reset(new content::TestBrowserThread(BrowserThread::IO,
- &message_loop_));
}
virtual void TearDown() OVERRIDE {
@@ -104,7 +101,7 @@ class NativeMessagingTest : public ::testing::Test,
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE,
native_message_process_host_.release());
}
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
virtual void PostMessageFromNativeProcess(
@@ -149,10 +146,8 @@ class NativeMessagingTest : public ::testing::Test,
Feature::ScopedCurrentChannel current_channel_;
scoped_ptr<NativeMessageProcessHost> native_message_process_host_;
base::FilePath user_data_dir_;
- base::MessageLoopForIO message_loop_;
scoped_ptr<base::RunLoop> read_message_run_loop_;
- scoped_ptr<content::TestBrowserThread> ui_thread_;
- scoped_ptr<content::TestBrowserThread> io_thread_;
+ content::TestBrowserThreadBundle thread_bundle_;
scoped_ptr<DictionaryValue> last_message_;
};
@@ -197,10 +192,10 @@ TEST_F(NativeMessagingTest, SingleSendMessageWrite) {
AsWeakPtr(), kTestNativeMessagingExtensionId, "empty_app.py",
0, launcher.Pass());
ASSERT_TRUE(native_message_process_host_.get());
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
native_message_process_host_->Send(kTestMessage);
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
std::string output;
base::TimeTicks start_time = base::TimeTicks::Now();

Powered by Google App Engine
This is Rietveld 408576698