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 32cf9ce402652fb198c2a8abe2a91f29d49f210c..7af4a91fa0d4ca2d0cc4e5e7a8fe05b65cf4c0b5 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 |
@@ -106,14 +106,14 @@ class NativeMessagingTest : public ::testing::Test, |
} |
virtual void TearDown() OVERRIDE { |
- if (native_message_process_host_.get()) { |
+ if (native_message_host_.get()) { |
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, |
- native_message_process_host_.release()); |
+ native_message_host_.release()); |
} |
base::RunLoop().RunUntilIdle(); |
} |
- virtual void PostMessageFromNativeProcess( |
+ virtual void PostMessageFromNative( |
int port_id, |
const std::string& message) OVERRIDE { |
last_message_ = message; |
@@ -164,7 +164,7 @@ class NativeMessagingTest : public ::testing::Test, |
base::ScopedTempDir temp_dir_; |
// Force the channel to be dev. |
ScopedCurrentChannel current_channel_; |
- scoped_ptr<NativeMessageProcessHost> native_message_process_host_; |
+ scoped_ptr<NativeMessageHost> native_message_host_; |
scoped_ptr<base::RunLoop> run_loop_; |
content::TestBrowserThreadBundle thread_bundle_; |
std::string last_message_; |
@@ -180,15 +180,17 @@ TEST_F(NativeMessagingTest, SingleSendMessageRead) { |
scoped_ptr<NativeProcessLauncher> launcher = |
FakeLauncher::Create(temp_input_file, temp_output_file).Pass(); |
- native_message_process_host_ = NativeMessageProcessHost::CreateWithLauncher( |
+ native_message_host_ = NativeMessageProcessHost::CreateWithLauncher( |
AsWeakPtr(), ScopedTestNativeMessagingHost::kExtensionId, "empty_app.py", |
0, launcher.Pass()); |
- ASSERT_TRUE(native_message_process_host_.get()); |
+ ASSERT_TRUE(native_message_host_.get()); |
run_loop_.reset(new base::RunLoop()); |
run_loop_->RunUntilIdle(); |
if (last_message_.empty()) { |
run_loop_.reset(new base::RunLoop()); |
+ scoped_ptr<NativeMessageProcessHost> native_message_process_host_( |
+ static_cast<NativeMessageProcessHost*>(native_message_host_.release())); |
native_message_process_host_->ReadNowForTesting(); |
run_loop_->Run(); |
} |
@@ -226,13 +228,13 @@ TEST_F(NativeMessagingTest, SingleSendMessageWrite) { |
scoped_ptr<NativeProcessLauncher> launcher = |
FakeLauncher::CreateWithPipeInput(read_file.Pass(), |
temp_output_file).Pass(); |
- native_message_process_host_ = NativeMessageProcessHost::CreateWithLauncher( |
+ native_message_host_ = NativeMessageProcessHost::CreateWithLauncher( |
AsWeakPtr(), ScopedTestNativeMessagingHost::kExtensionId, "empty_app.py", |
0, launcher.Pass()); |
- ASSERT_TRUE(native_message_process_host_.get()); |
+ ASSERT_TRUE(native_message_host_.get()); |
base::RunLoop().RunUntilIdle(); |
- native_message_process_host_->Send(kTestMessage); |
+ native_message_host_->Send(kTestMessage); |
base::RunLoop().RunUntilIdle(); |
std::string output; |
@@ -253,12 +255,12 @@ TEST_F(NativeMessagingTest, EchoConnect) { |
ScopedTestNativeMessagingHost test_host; |
ASSERT_NO_FATAL_FAILURE(test_host.RegisterTestHost(false)); |
- native_message_process_host_ = NativeMessageProcessHost::Create( |
+ native_message_host_ = NativeMessageProcessHost::Create( |
NULL, AsWeakPtr(), ScopedTestNativeMessagingHost::kExtensionId, |
ScopedTestNativeMessagingHost::kHostName, 0, false); |
- ASSERT_TRUE(native_message_process_host_.get()); |
+ ASSERT_TRUE(native_message_host_.get()); |
- native_message_process_host_->Send("{\"text\": \"Hello.\"}"); |
+ native_message_host_->Send("{\"text\": \"Hello.\"}"); |
run_loop_.reset(new base::RunLoop()); |
run_loop_->Run(); |
ASSERT_FALSE(last_message_.empty()); |
@@ -276,7 +278,7 @@ TEST_F(NativeMessagingTest, EchoConnect) { |
EXPECT_TRUE(last_message_parsed_->GetString("caller_url", &url)); |
EXPECT_EQ(expected_url, url); |
- native_message_process_host_->Send("{\"foo\": \"bar\"}"); |
+ native_message_host_->Send("{\"foo\": \"bar\"}"); |
run_loop_.reset(new base::RunLoop()); |
run_loop_->Run(); |
EXPECT_TRUE(last_message_parsed_->GetInteger("id", &id)); |
@@ -291,12 +293,12 @@ TEST_F(NativeMessagingTest, UserLevel) { |
ScopedTestNativeMessagingHost test_host; |
ASSERT_NO_FATAL_FAILURE(test_host.RegisterTestHost(true)); |
- native_message_process_host_ = NativeMessageProcessHost::Create( |
+ native_message_host_ = NativeMessageProcessHost::Create( |
NULL, AsWeakPtr(), ScopedTestNativeMessagingHost::kExtensionId, |
ScopedTestNativeMessagingHost::kHostName, 0, true); |
- ASSERT_TRUE(native_message_process_host_.get()); |
+ ASSERT_TRUE(native_message_host_.get()); |
- native_message_process_host_->Send("{\"text\": \"Hello.\"}"); |
+ native_message_host_->Send("{\"text\": \"Hello.\"}"); |
run_loop_.reset(new base::RunLoop()); |
run_loop_->Run(); |
ASSERT_FALSE(last_message_.empty()); |
@@ -307,10 +309,10 @@ TEST_F(NativeMessagingTest, DisallowUserLevel) { |
ScopedTestNativeMessagingHost test_host; |
ASSERT_NO_FATAL_FAILURE(test_host.RegisterTestHost(true)); |
- native_message_process_host_ = NativeMessageProcessHost::Create( |
+ native_message_host_ = NativeMessageProcessHost::Create( |
NULL, AsWeakPtr(), ScopedTestNativeMessagingHost::kExtensionId, |
ScopedTestNativeMessagingHost::kHostName, 0, false); |
- ASSERT_TRUE(native_message_process_host_.get()); |
+ ASSERT_TRUE(native_message_host_.get()); |
run_loop_.reset(new base::RunLoop()); |
run_loop_->Run(); |