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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 base::PlatformFile read_file_; | 75 base::PlatformFile read_file_; |
76 base::PlatformFile write_file_; | 76 base::PlatformFile write_file_; |
77 }; | 77 }; |
78 | 78 |
79 class NativeMessagingTest : public ::testing::Test, | 79 class NativeMessagingTest : public ::testing::Test, |
80 public NativeMessageProcessHost::Client, | 80 public NativeMessageProcessHost::Client, |
81 public base::SupportsWeakPtr<NativeMessagingTest> { | 81 public base::SupportsWeakPtr<NativeMessagingTest> { |
82 protected: | 82 protected: |
83 NativeMessagingTest() | 83 NativeMessagingTest() |
84 : current_channel_(chrome::VersionInfo::CHANNEL_DEV), | 84 : current_channel_(chrome::VersionInfo::CHANNEL_DEV), |
85 native_message_process_host_(NULL), | 85 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} |
86 thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | |
87 } | |
88 | 86 |
89 virtual void SetUp() OVERRIDE { | 87 virtual void SetUp() OVERRIDE { |
90 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 88 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
91 // Change the user data dir so native apps will be looked for in the test | 89 // Change the user data dir so native apps will be looked for in the test |
92 // directory. | 90 // directory. |
93 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)); | 91 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)); |
94 ASSERT_TRUE(PathService::Override(chrome::DIR_USER_DATA, GetTestDir())); | 92 ASSERT_TRUE(PathService::Override(chrome::DIR_USER_DATA, GetTestDir())); |
95 } | 93 } |
96 | 94 |
97 virtual void TearDown() OVERRIDE { | 95 virtual void TearDown() OVERRIDE { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 read_message_run_loop_->Run(); | 248 read_message_run_loop_->Run(); |
251 EXPECT_TRUE(last_message_->GetInteger("id", &id)); | 249 EXPECT_TRUE(last_message_->GetInteger("id", &id)); |
252 EXPECT_EQ(2, id); | 250 EXPECT_EQ(2, id); |
253 EXPECT_TRUE(last_message_->GetString("echo.foo", &text)); | 251 EXPECT_TRUE(last_message_->GetString("echo.foo", &text)); |
254 EXPECT_EQ("bar", text); | 252 EXPECT_EQ("bar", text); |
255 EXPECT_TRUE(last_message_->GetString("caller_url", &url)); | 253 EXPECT_TRUE(last_message_->GetString("caller_url", &url)); |
256 EXPECT_EQ(expected_url, url); | 254 EXPECT_EQ(expected_url, url); |
257 } | 255 } |
258 | 256 |
259 } // namespace extensions | 257 } // namespace extensions |
OLD | NEW |