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 // Tab API implementation unit tests. | 5 // Tab API implementation unit tests. |
6 | 6 |
7 // MockWin32 can't be included after ChromeFrameHost because of an include | 7 // MockWin32 can't be included after ChromeFrameHost because of an include |
8 // incompatibility with atlwin.h. | 8 // incompatibility with atlwin.h. |
9 #include "ceee/testing/utils/mock_win32.h" // NOLINT | 9 #include "ceee/testing/utils/mock_win32.h" // NOLINT |
10 | 10 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 DoAll(CopyStringToArgument<1>(kClassName), | 426 DoAll(CopyStringToArgument<1>(kClassName), |
427 Return(arraysize(kClassName)))); | 427 Return(arraysize(kClassName)))); |
428 TabApiResult invocation_result(TabApiResult::kNoRequestId); | 428 TabApiResult invocation_result(TabApiResult::kNoRequestId); |
429 EXPECT_TRUE(invocation_result.IsTabWindowClass(reinterpret_cast<HWND>(1))); | 429 EXPECT_TRUE(invocation_result.IsTabWindowClass(reinterpret_cast<HWND>(1))); |
430 } | 430 } |
431 | 431 |
432 TEST(TabApi, GetSpecifiedOrCurrentFrameWindow) { | 432 TEST(TabApi, GetSpecifiedOrCurrentFrameWindow) { |
433 testing::LogDisabler no_dchecks; | 433 testing::LogDisabler no_dchecks; |
434 | 434 |
435 StrictMock<testing::MockWindowUtils> window_utils; | 435 StrictMock<testing::MockWindowUtils> window_utils; |
436 scoped_ptr<Value> bad_args(Value::CreateRealValue(4.7)); | 436 scoped_ptr<Value> bad_args(Value::CreateDoubleValue(4.7)); |
437 DictionaryValue bad_dict_args; // no window ID key. | 437 DictionaryValue bad_dict_args; // no window ID key. |
438 DictionaryValue good_dict_args; | 438 DictionaryValue good_dict_args; |
439 int window1_id = 77; | 439 int window1_id = 77; |
440 HWND window1 = reinterpret_cast<HWND>(window1_id); | 440 HWND window1 = reinterpret_cast<HWND>(window1_id); |
441 good_dict_args.SetInteger(ext::kWindowIdKey, window1_id); | 441 good_dict_args.SetInteger(ext::kWindowIdKey, window1_id); |
442 | 442 |
443 StrictMock<MockTabApiResult> invocation_result(TabApiResult::kNoRequestId); | 443 StrictMock<MockTabApiResult> invocation_result(TabApiResult::kNoRequestId); |
444 | 444 |
445 // First, fail because no method finds us a window. | 445 // First, fail because no method finds us a window. |
446 EXPECT_CALL(window_utils, FindDescendentWindow(_, _, _, _)) | 446 EXPECT_CALL(window_utils, FindDescendentWindow(_, _, _, _)) |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 EXPECT_EQ(TabApiResult::IsTabFromSameOrUnspecifiedFrameWindow( | 1556 EXPECT_EQ(TabApiResult::IsTabFromSameOrUnspecifiedFrameWindow( |
1557 input_dict, &other_saved_window, NULL, &mock_api_dispatcher), S_FALSE); | 1557 input_dict, &other_saved_window, NULL, &mock_api_dispatcher), S_FALSE); |
1558 tab_window = NULL; | 1558 tab_window = NULL; |
1559 EXPECT_EQ(TabApiResult::IsTabFromSameOrUnspecifiedFrameWindow( | 1559 EXPECT_EQ(TabApiResult::IsTabFromSameOrUnspecifiedFrameWindow( |
1560 input_dict, &other_saved_window, &tab_window, &mock_api_dispatcher), | 1560 input_dict, &other_saved_window, &tab_window, &mock_api_dispatcher), |
1561 S_FALSE); | 1561 S_FALSE); |
1562 EXPECT_EQ(kGoodTabWindow, tab_window); | 1562 EXPECT_EQ(kGoodTabWindow, tab_window); |
1563 } | 1563 } |
1564 | 1564 |
1565 } // namespace | 1565 } // namespace |
OLD | NEW |