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

Side by Side Diff: chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc

Issue 22532011: Pass handle of the native view window to the native messaging host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 std::string(kTestNativeMessagingHostName) + ".json"); 211 std::string(kTestNativeMessagingHostName) + ".json");
212 ASSERT_NO_FATAL_FAILURE(CreateTestNativeHostManifest(manifest_path)); 212 ASSERT_NO_FATAL_FAILURE(CreateTestNativeHostManifest(manifest_path));
213 213
214 std::string hosts_option = base::StringPrintf( 214 std::string hosts_option = base::StringPrintf(
215 "%s=%s", extensions::kTestNativeMessagingHostName, 215 "%s=%s", extensions::kTestNativeMessagingHostName,
216 manifest_path.AsUTF8Unsafe().c_str()); 216 manifest_path.AsUTF8Unsafe().c_str());
217 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 217 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
218 switches::kNativeMessagingHosts, hosts_option); 218 switches::kNativeMessagingHosts, hosts_option);
219 219
220 native_message_process_host_ = NativeMessageProcessHost::Create( 220 native_message_process_host_ = NativeMessageProcessHost::Create(
221 AsWeakPtr(), kTestNativeMessagingExtensionId, 221 gfx::NativeView(), AsWeakPtr(), kTestNativeMessagingExtensionId,
222 kTestNativeMessagingHostName, 0); 222 kTestNativeMessagingHostName, 0);
223 ASSERT_TRUE(native_message_process_host_.get()); 223 ASSERT_TRUE(native_message_process_host_.get());
224 224
225 native_message_process_host_->Send("{\"text\": \"Hello.\"}"); 225 native_message_process_host_->Send("{\"text\": \"Hello.\"}");
226 read_message_run_loop_.reset(new base::RunLoop()); 226 read_message_run_loop_.reset(new base::RunLoop());
227 read_message_run_loop_->Run(); 227 read_message_run_loop_->Run();
228 ASSERT_FALSE(last_message_.empty()); 228 ASSERT_FALSE(last_message_.empty());
229 ASSERT_TRUE(last_message_parsed_); 229 ASSERT_TRUE(last_message_parsed_);
230 230
231 std::string expected_url = std::string("chrome-extension://") + 231 std::string expected_url = std::string("chrome-extension://") +
(...skipping 14 matching lines...) Expand all
246 read_message_run_loop_->Run(); 246 read_message_run_loop_->Run();
247 EXPECT_TRUE(last_message_parsed_->GetInteger("id", &id)); 247 EXPECT_TRUE(last_message_parsed_->GetInteger("id", &id));
248 EXPECT_EQ(2, id); 248 EXPECT_EQ(2, id);
249 EXPECT_TRUE(last_message_parsed_->GetString("echo.foo", &text)); 249 EXPECT_TRUE(last_message_parsed_->GetString("echo.foo", &text));
250 EXPECT_EQ("bar", text); 250 EXPECT_EQ("bar", text);
251 EXPECT_TRUE(last_message_parsed_->GetString("caller_url", &url)); 251 EXPECT_TRUE(last_message_parsed_->GetString("caller_url", &url));
252 EXPECT_EQ(expected_url, url); 252 EXPECT_EQ(expected_url, url);
253 } 253 }
254 254
255 } // namespace extensions 255 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698