| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // IE toolband unit tests. | 5 // IE toolband unit tests. |
| 6 #include "ceee/ie/plugin/toolband/tool_band.h" | 6 #include "ceee/ie/plugin/toolband/tool_band.h" |
| 7 | 7 |
| 8 #include <exdisp.h> | 8 #include <exdisp.h> |
| 9 #include <shlguid.h> | 9 #include <shlguid.h> |
| 10 | 10 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 | 504 |
| 505 TEST_F(ToolBandTest, SendSessionIdToBho) { | 505 TEST_F(ToolBandTest, SendSessionIdToBho) { |
| 506 MockCeeeBho* mock_bho; | 506 MockCeeeBho* mock_bho; |
| 507 CComPtr<IObjectWithSite> mock_bho_with_site; | 507 CComPtr<IObjectWithSite> mock_bho_with_site; |
| 508 ASSERT_HRESULT_SUCCEEDED( | 508 ASSERT_HRESULT_SUCCEEDED( |
| 509 MockCeeeBho::CreateInitialized(&mock_bho, &mock_bho_with_site)); | 509 MockCeeeBho::CreateInitialized(&mock_bho, &mock_bho_with_site)); |
| 510 EXPECT_CALL(*tool_band_, GetSessionId(_)).WillOnce(DoAll( | 510 EXPECT_CALL(*tool_band_, GetSessionId(_)).WillOnce(DoAll( |
| 511 SetArgumentPointee<0>(5), Return(S_OK))); | 511 SetArgumentPointee<0>(5), Return(S_OK))); |
| 512 EXPECT_CALL(*mock_bho, SetToolBandSessionId(5)).WillOnce(Return(S_OK)); | 512 EXPECT_CALL(*mock_bho, SetToolBandSessionId(5)).WillOnce(Return(S_OK)); |
| 513 EXPECT_EQ(S_OK, tool_band_->CallSendSessionIdToBho(mock_bho_with_site)); | 513 EXPECT_EQ(S_OK, tool_band_->CallSendSessionIdToBho(mock_bho_with_site)); |
| 514 // Second call should not do anything. |
| 515 EXPECT_EQ(S_FALSE, tool_band_->CallSendSessionIdToBho(mock_bho_with_site)); |
| 516 } |
| 514 | 517 |
| 515 // Test error handling. | 518 TEST_F(ToolBandTest, SendSessionIdToBhoErrorHandling) { |
| 519 MockCeeeBho* mock_bho; |
| 520 CComPtr<IObjectWithSite> mock_bho_with_site; |
| 521 ASSERT_HRESULT_SUCCEEDED( |
| 522 MockCeeeBho::CreateInitialized(&mock_bho, &mock_bho_with_site)); |
| 516 EXPECT_CALL(*tool_band_, GetSessionId(_)).WillOnce(Return(E_FAIL)); | 523 EXPECT_CALL(*tool_band_, GetSessionId(_)).WillOnce(Return(E_FAIL)); |
| 517 EXPECT_EQ(E_FAIL, tool_band_->CallSendSessionIdToBho(mock_bho_with_site)); | 524 EXPECT_EQ(E_FAIL, tool_band_->CallSendSessionIdToBho(mock_bho_with_site)); |
| 518 | 525 |
| 519 EXPECT_CALL(*tool_band_, GetSessionId(_)).WillOnce(DoAll( | 526 EXPECT_CALL(*tool_band_, GetSessionId(_)).WillOnce(DoAll( |
| 520 SetArgumentPointee<0>(6), Return(S_OK))); | 527 SetArgumentPointee<0>(6), Return(S_OK))); |
| 521 EXPECT_CALL(*mock_bho, SetToolBandSessionId(6)).WillOnce(Return(E_FAIL)); | 528 EXPECT_CALL(*mock_bho, SetToolBandSessionId(6)).WillOnce(Return(E_FAIL)); |
| 522 EXPECT_EQ(E_FAIL, tool_band_->CallSendSessionIdToBho(mock_bho_with_site)); | 529 EXPECT_EQ(E_FAIL, tool_band_->CallSendSessionIdToBho(mock_bho_with_site)); |
| 523 } | 530 } |
| 524 | 531 |
| 525 } // namespace | 532 } // namespace |
| OLD | NEW |