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_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 EXPECT_TRUE(file_util::WriteFile( | 146 EXPECT_TRUE(file_util::WriteFile( |
147 filename, message_with_header.data(), message_with_header.size())); | 147 filename, message_with_header.data(), message_with_header.size())); |
148 return filename; | 148 return filename; |
149 } | 149 } |
150 | 150 |
151 // Force the channel to be dev. | 151 // Force the channel to be dev. |
152 base::ScopedTempDir temp_dir_; | 152 base::ScopedTempDir temp_dir_; |
153 Feature::ScopedCurrentChannel current_channel_; | 153 Feature::ScopedCurrentChannel current_channel_; |
154 scoped_ptr<NativeMessageProcessHost> native_message_process_host_; | 154 scoped_ptr<NativeMessageProcessHost> native_message_process_host_; |
155 base::FilePath user_data_dir_; | 155 base::FilePath user_data_dir_; |
156 MessageLoopForIO message_loop_; | 156 base::MessageLoopForIO message_loop_; |
157 scoped_ptr<base::RunLoop> read_message_run_loop_; | 157 scoped_ptr<base::RunLoop> read_message_run_loop_; |
158 scoped_ptr<content::TestBrowserThread> ui_thread_; | 158 scoped_ptr<content::TestBrowserThread> ui_thread_; |
159 scoped_ptr<content::TestBrowserThread> io_thread_; | 159 scoped_ptr<content::TestBrowserThread> io_thread_; |
160 std::string last_message_; | 160 std::string last_message_; |
161 scoped_ptr<base::DictionaryValue> last_message_parsed_; | 161 scoped_ptr<base::DictionaryValue> last_message_parsed_; |
162 }; | 162 }; |
163 | 163 |
164 // Read a single message from a local file. | 164 // Read a single message from a local file. |
165 TEST_F(NativeMessagingTest, SingleSendMessageRead) { | 165 TEST_F(NativeMessagingTest, SingleSendMessageRead) { |
166 base::FilePath temp_output_file = temp_dir_.path().AppendASCII("output"); | 166 base::FilePath temp_output_file = temp_dir_.path().AppendASCII("output"); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 read_message_run_loop_->Run(); | 254 read_message_run_loop_->Run(); |
255 EXPECT_TRUE(last_message_parsed_->GetInteger("id", &id)); | 255 EXPECT_TRUE(last_message_parsed_->GetInteger("id", &id)); |
256 EXPECT_EQ(2, id); | 256 EXPECT_EQ(2, id); |
257 EXPECT_TRUE(last_message_parsed_->GetString("echo.foo", &text)); | 257 EXPECT_TRUE(last_message_parsed_->GetString("echo.foo", &text)); |
258 EXPECT_EQ("bar", text); | 258 EXPECT_EQ("bar", text); |
259 EXPECT_TRUE(last_message_parsed_->GetString("caller_url", &url)); | 259 EXPECT_TRUE(last_message_parsed_->GetString("caller_url", &url)); |
260 EXPECT_EQ(expected_url, url); | 260 EXPECT_EQ(expected_url, url); |
261 } | 261 } |
262 | 262 |
263 } // namespace extensions | 263 } // namespace extensions |
OLD | NEW |