| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 BreakpadWinDeathTest::~BreakpadWinDeathTest() { | 85 BreakpadWinDeathTest::~BreakpadWinDeathTest() { |
| 86 } | 86 } |
| 87 | 87 |
| 88 void BreakpadWinDeathTest::SetUp() { | 88 void BreakpadWinDeathTest::SetUp() { |
| 89 scoped_ptr<base::Environment> environment(base::Environment::Create()); | 89 scoped_ptr<base::Environment> environment(base::Environment::Create()); |
| 90 std::string pipe_name; | 90 std::string pipe_name; |
| 91 if (environment->GetVar(kPipeVariableName, &pipe_name)) { | 91 if (environment->GetVar(kPipeVariableName, &pipe_name)) { |
| 92 // This is a child process. Initialize crash dump reporting to the crash | 92 // This is a child process. Initialize crash dump reporting to the crash |
| 93 // dump server. | 93 // dump server. |
| 94 pipe_name_ = UTF8ToWide(pipe_name); | 94 pipe_name_ = base::UTF8ToWide(pipe_name); |
| 95 InitializeCrashReportingForTest(pipe_name_.c_str()); | 95 InitializeCrashReportingForTest(pipe_name_.c_str()); |
| 96 } else { | 96 } else { |
| 97 // This is the parent process. Generate a unique pipe name and setup | 97 // This is the parent process. Generate a unique pipe name and setup |
| 98 // a dummy crash dump server. | 98 // a dummy crash dump server. |
| 99 UUID guid = {0}; | 99 UUID guid = {0}; |
| 100 RPC_STATUS status = UuidCreate(&guid); | 100 RPC_STATUS status = UuidCreate(&guid); |
| 101 EXPECT_TRUE(status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY); | 101 EXPECT_TRUE(status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY); |
| 102 | 102 |
| 103 pipe_name_ = | 103 pipe_name_ = |
| 104 base::StringPrintf( | 104 base::StringPrintf( |
| 105 L"%ls%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", | 105 L"%ls%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", |
| 106 kPipeNamePrefix, | 106 kPipeNamePrefix, |
| 107 guid.Data1, | 107 guid.Data1, |
| 108 guid.Data2, | 108 guid.Data2, |
| 109 guid.Data3, | 109 guid.Data3, |
| 110 guid.Data4[0], | 110 guid.Data4[0], |
| 111 guid.Data4[1], | 111 guid.Data4[1], |
| 112 guid.Data4[2], | 112 guid.Data4[2], |
| 113 guid.Data4[3], | 113 guid.Data4[3], |
| 114 guid.Data4[4], | 114 guid.Data4[4], |
| 115 guid.Data4[5], | 115 guid.Data4[5], |
| 116 guid.Data4[6], | 116 guid.Data4[6], |
| 117 guid.Data4[7]); | 117 guid.Data4[7]); |
| 118 EXPECT_TRUE(environment->SetVar(kPipeVariableName, | 118 EXPECT_TRUE(environment->SetVar(kPipeVariableName, |
| 119 WideToUTF8(pipe_name_))); | 119 base::WideToUTF8(pipe_name_))); |
| 120 | 120 |
| 121 // Setup a dummy crash dump server. | 121 // Setup a dummy crash dump server. |
| 122 callbacks_.reset(new MockCrashServerCallbacks()); | 122 callbacks_.reset(new MockCrashServerCallbacks()); |
| 123 crash_server_.reset( | 123 crash_server_.reset( |
| 124 new google_breakpad::CrashGenerationServer( | 124 new google_breakpad::CrashGenerationServer( |
| 125 pipe_name_, | 125 pipe_name_, |
| 126 NULL, | 126 NULL, |
| 127 NULL, | 127 NULL, |
| 128 NULL, | 128 NULL, |
| 129 MockCrashServerCallbacks::OnClientDumpRequestCallback, | 129 MockCrashServerCallbacks::OnClientDumpRequestCallback, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 159 TEST_F(BreakpadWinDeathTest, TestDebugbreak) { | 159 TEST_F(BreakpadWinDeathTest, TestDebugbreak) { |
| 160 if (callbacks_.get()) { | 160 if (callbacks_.get()) { |
| 161 EXPECT_CALL(*callbacks_, OnClientDumpRequested()); | 161 EXPECT_CALL(*callbacks_, OnClientDumpRequested()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 // See if __debugbreak() is intercepted. | 164 // See if __debugbreak() is intercepted. |
| 165 ASSERT_DEATH(__debugbreak(), ""); | 165 ASSERT_DEATH(__debugbreak(), ""); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace remoting | 168 } // namespace remoting |
| OLD | NEW |