| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome_frame/test/ie_event_sink.h" | 5 #include "chrome_frame/test/ie_event_sink.h" |
| 6 | 6 |
| 7 #include "base/scoped_handle.h" | |
| 8 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 11 #include "base/win/scoped_bstr.h" | 10 #include "base/win/scoped_bstr.h" |
| 11 #include "base/win/scoped_handle.h" |
| 12 #include "base/win/scoped_variant.h" | 12 #include "base/win/scoped_variant.h" |
| 13 #include "chrome_frame/test/chrome_frame_test_utils.h" | 13 #include "chrome_frame/test/chrome_frame_test_utils.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using base::win::ScopedBstr; | 16 using base::win::ScopedBstr; |
| 17 | 17 |
| 18 namespace chrome_frame_test { | 18 namespace chrome_frame_test { |
| 19 | 19 |
| 20 const int kDefaultWaitForIEToTerminateMs = 10 * 1000; | 20 const int kDefaultWaitForIEToTerminateMs = 10 * 1000; |
| 21 | 21 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 std::wstring browser_url_wstring; | 140 std::wstring browser_url_wstring; |
| 141 browser_url_wstring.assign(browser_url, browser_url.Length()); | 141 browser_url_wstring.assign(browser_url, browser_url.Length()); |
| 142 std::string browser_url_string = WideToUTF8(browser_url_wstring); | 142 std::string browser_url_string = WideToUTF8(browser_url_wstring); |
| 143 EXPECT_TRUE(did_receive_on_quit_) << "OnQuit was not received for " | 143 EXPECT_TRUE(did_receive_on_quit_) << "OnQuit was not received for " |
| 144 << "browser with url " | 144 << "browser with url " |
| 145 << browser_url_string; | 145 << browser_url_string; |
| 146 | 146 |
| 147 web_browser2_->Quit(); | 147 web_browser2_->Quit(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 ScopedHandle process; | 150 base::win::ScopedHandle process; |
| 151 process.Set(OpenProcess(SYNCHRONIZE, FALSE, | 151 process.Set(OpenProcess(SYNCHRONIZE, FALSE, ie_process_id_)); |
| 152 ie_process_id_)); | |
| 153 web_browser2_.Release(); | 152 web_browser2_.Release(); |
| 154 | 153 |
| 155 if (!process.IsValid()) { | 154 if (!process.IsValid()) { |
| 156 DLOG_IF(WARNING, !process.IsValid()) | 155 DLOG_IF(WARNING, !process.IsValid()) |
| 157 << base::StringPrintf("OpenProcess failed: %i", ::GetLastError()); | 156 << base::StringPrintf("OpenProcess failed: %i", ::GetLastError()); |
| 158 return; | 157 return; |
| 159 } | 158 } |
| 160 // IE may not have closed yet. Wait here for the process to finish. | 159 // IE may not have closed yet. Wait here for the process to finish. |
| 161 // This is necessary at least on some browser/platform configurations. | 160 // This is necessary at least on some browser/platform configurations. |
| 162 WaitForSingleObject(process, kDefaultWaitForIEToTerminateMs); | 161 WaitForSingleObject(process, kDefaultWaitForIEToTerminateMs); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 source.Receive(), NULL, NULL)); | 577 source.Receive(), NULL, NULL)); |
| 579 } | 578 } |
| 580 } | 579 } |
| 581 | 580 |
| 582 if (listener_) | 581 if (listener_) |
| 583 listener_->OnMessage(V_BSTR(&data), V_BSTR(&origin), V_BSTR(&source)); | 582 listener_->OnMessage(V_BSTR(&data), V_BSTR(&origin), V_BSTR(&source)); |
| 584 return S_OK; | 583 return S_OK; |
| 585 } | 584 } |
| 586 | 585 |
| 587 } // namespace chrome_frame_test | 586 } // namespace chrome_frame_test |
| OLD | NEW |