Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ipc/attachment_broker_privileged_win.h" | 13 #include "ipc/attachment_broker_privileged_win.h" |
| 14 #include "ipc/attachment_broker_unprivileged_win.h" | 14 #include "ipc/attachment_broker_unprivileged_win.h" |
| 15 #include "ipc/handle_attachment_win.h" | 15 #include "ipc/handle_attachment_win.h" |
| 16 #include "ipc/handle_win.h" | 16 #include "ipc/handle_win.h" |
| 17 #include "ipc/ipc_listener.h" | 17 #include "ipc/ipc_listener.h" |
| 18 #include "ipc/ipc_message.h" | 18 #include "ipc/ipc_message.h" |
| 19 #include "ipc/ipc_test_base.h" | 19 #include "ipc/ipc_test_base.h" |
| 20 | 20 |
| 21 // TODO(erikchen): Temporarily disabled. http://crbug.com/493414. | |
|
Tom Sepez
2015/09/01 18:01:54
Do not comment out disabled test code. Instead, n
erikchen
2015/09/04 02:13:39
Not sure what I was thinking. I also moved this in
| |
| 22 /* | |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 const char kDataBuffer[] = "This is some test data to write to the file."; | 25 const char kDataBuffer[] = "This is some test data to write to the file."; |
| 24 | 26 |
| 25 // Returns the contents of the file represented by |h| as a std::string. | 27 // Returns the contents of the file represented by |h| as a std::string. |
| 26 std::string ReadFromFile(HANDLE h) { | 28 std::string ReadFromFile(HANDLE h) { |
| 27 SetFilePointer(h, 0, nullptr, FILE_BEGIN); | 29 SetFilePointer(h, 0, nullptr, FILE_BEGIN); |
| 28 char buffer[100]; | 30 char buffer[100]; |
| 29 DWORD bytes_read; | 31 DWORD bytes_read; |
| 30 BOOL success = ::ReadFile(h, buffer, static_cast<DWORD>(strlen(kDataBuffer)), | 32 BOOL success = ::ReadFile(h, buffer, static_cast<DWORD>(strlen(kDataBuffer)), |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 | 303 |
| 302 // But it still points to the same file. | 304 // But it still points to the same file. |
| 303 std::string contents = ReadFromFile(h); | 305 std::string contents = ReadFromFile(h); |
| 304 EXPECT_EQ(contents, std::string(kDataBuffer)); | 306 EXPECT_EQ(contents, std::string(kDataBuffer)); |
| 305 | 307 |
| 306 CommonTearDown(); | 308 CommonTearDown(); |
| 307 } | 309 } |
| 308 | 310 |
| 309 // Similar to SendHandle, except this test uses the HandleWin class. | 311 // Similar to SendHandle, except this test uses the HandleWin class. |
| 310 TEST_F(IPCAttachmentBrokerPrivilegedWinTest, SendHandleWin) { | 312 TEST_F(IPCAttachmentBrokerPrivilegedWinTest, SendHandleWin) { |
| 313 | |
| 311 Init("SendHandleWin"); | 314 Init("SendHandleWin"); |
| 312 | 315 |
| 313 CommonSetUp(); | 316 CommonSetUp(); |
| 314 ResultListener result_listener; | 317 ResultListener result_listener; |
| 315 get_proxy_listener()->set_listener(&result_listener); | 318 get_proxy_listener()->set_listener(&result_listener); |
| 316 | 319 |
| 317 HANDLE h = CreateTempFile(); | 320 HANDLE h = CreateTempFile(); |
| 318 IPC::HandleWin handle_win(h, IPC::HandleWin::FILE_READ_WRITE); | 321 IPC::HandleWin handle_win(h, IPC::HandleWin::FILE_READ_WRITE); |
| 319 IPC::Message* message = new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); | 322 IPC::Message* message = new IPC::Message(0, 2, IPC::Message::PRIORITY_NORMAL); |
| 320 message->WriteInt(0); | 323 message->WriteInt(0); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendHandleToSelf) { | 425 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendHandleToSelf) { |
| 423 return CommonPrivilegedProcessMain(&SendHandleToSelfCallback, | 426 return CommonPrivilegedProcessMain(&SendHandleToSelfCallback, |
| 424 "SendHandleToSelf"); | 427 "SendHandleToSelf"); |
| 425 } | 428 } |
| 426 | 429 |
| 427 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendHandleWin) { | 430 MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendHandleWin) { |
| 428 return CommonPrivilegedProcessMain(&SendHandleCallback, "SendHandleWin"); | 431 return CommonPrivilegedProcessMain(&SendHandleCallback, "SendHandleWin"); |
| 429 } | 432 } |
| 430 | 433 |
| 431 } // namespace | 434 } // namespace |
| 435 */ | |
| OLD | NEW |