| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 launcher); | 149 launcher); |
| 150 message_loop_.RunAllPending(); | 150 message_loop_.RunAllPending(); |
| 151 ASSERT_TRUE(native_message_process_host_); | 151 ASSERT_TRUE(native_message_process_host_); |
| 152 | 152 |
| 153 EXPECT_TRUE(file_util::ContentsEqual( | 153 EXPECT_TRUE(file_util::ContentsEqual( |
| 154 temp_file, GetTestDir().AppendASCII("single_message_request.msg"))); | 154 temp_file, GetTestDir().AppendASCII("single_message_request.msg"))); |
| 155 | 155 |
| 156 file_util::Delete(temp_file, false /* non-recursive */); | 156 file_util::Delete(temp_file, false /* non-recursive */); |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Disabled, see http://crbug.com/159754. |
| 159 // Test send message with a real client. The client just echo's back the text | 160 // Test send message with a real client. The client just echo's back the text |
| 160 // it recieved. | 161 // it recieved. |
| 161 TEST_F(NativeMessagingTest, EchoConnect) { | 162 TEST_F(NativeMessagingTest, DISABLED_EchoConnect) { |
| 162 NativeMessageProcessHost::Create( | 163 NativeMessageProcessHost::Create( |
| 163 AsWeakPtr(), "echo.py", "{\"text\": \"Hello.\"}", 0, | 164 AsWeakPtr(), "echo.py", "{\"text\": \"Hello.\"}", 0, |
| 164 NativeMessageProcessHost::TYPE_CONNECT, base::Bind( | 165 NativeMessageProcessHost::TYPE_CONNECT, base::Bind( |
| 165 &NativeMessagingTest::AcquireProcess, AsWeakPtr())); | 166 &NativeMessagingTest::AcquireProcess, AsWeakPtr())); |
| 166 message_loop_.RunAllPending(); | 167 message_loop_.RunAllPending(); |
| 167 ASSERT_TRUE(native_message_process_host_); | 168 ASSERT_TRUE(native_message_process_host_); |
| 168 | 169 |
| 169 native_message_process_host_->ReadNowForTesting(); | 170 native_message_process_host_->ReadNowForTesting(); |
| 170 message_loop_.RunAllPending(); | 171 message_loop_.RunAllPending(); |
| 171 EXPECT_EQ(last_posted_message_, | 172 EXPECT_EQ(last_posted_message_, |
| 172 "{\"id\": 1, \"echo\": {\"text\": \"Hello.\"}}"); | 173 "{\"id\": 1, \"echo\": {\"text\": \"Hello.\"}}"); |
| 173 | 174 |
| 174 native_message_process_host_->Send("{\"foo\": \"bar\"}"); | 175 native_message_process_host_->Send("{\"foo\": \"bar\"}"); |
| 175 message_loop_.RunAllPending(); | 176 message_loop_.RunAllPending(); |
| 176 native_message_process_host_->ReadNowForTesting(); | 177 native_message_process_host_->ReadNowForTesting(); |
| 177 message_loop_.RunAllPending(); | 178 message_loop_.RunAllPending(); |
| 178 EXPECT_EQ(last_posted_message_, "{\"id\": 2, \"echo\": {\"foo\": \"bar\"}}"); | 179 EXPECT_EQ(last_posted_message_, "{\"id\": 2, \"echo\": {\"foo\": \"bar\"}}"); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace extensions | 182 } // namespace extensions |
| OLD | NEW |