| 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 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
| 8 #include "app/message_box_flags.h" | 8 #include "app/message_box_flags.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 : AutomationProxy(execution_timeout, false), | 635 : AutomationProxy(execution_timeout, false), |
| 636 host_window_style_(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VISIBLE), | 636 host_window_style_(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VISIBLE), |
| 637 host_window_(NULL) { | 637 host_window_(NULL) { |
| 638 } | 638 } |
| 639 | 639 |
| 640 ExternalTabUITestMockClient::~ExternalTabUITestMockClient() { | 640 ExternalTabUITestMockClient::~ExternalTabUITestMockClient() { |
| 641 EXPECT_TRUE(host_window_ == NULL); | 641 EXPECT_TRUE(host_window_ == NULL); |
| 642 } | 642 } |
| 643 | 643 |
| 644 void ExternalTabUITestMockClient::ReplyStarted( | 644 void ExternalTabUITestMockClient::ReplyStarted( |
| 645 const IPC::AutomationURLResponse* response, | 645 const AutomationURLResponse* response, |
| 646 int tab_handle, int request_id) { | 646 int tab_handle, int request_id) { |
| 647 AutomationProxy::Send(new AutomationMsg_RequestStarted(0, tab_handle, | 647 AutomationProxy::Send(new AutomationMsg_RequestStarted(tab_handle, |
| 648 request_id, *response)); | 648 request_id, *response)); |
| 649 } | 649 } |
| 650 | 650 |
| 651 void ExternalTabUITestMockClient::ReplyData( | 651 void ExternalTabUITestMockClient::ReplyData( |
| 652 const std::string* data, int tab_handle, int request_id) { | 652 const std::string* data, int tab_handle, int request_id) { |
| 653 AutomationProxy::Send(new AutomationMsg_RequestData(0, tab_handle, | 653 AutomationProxy::Send(new AutomationMsg_RequestData(tab_handle, |
| 654 request_id, *data)); | 654 request_id, *data)); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void ExternalTabUITestMockClient::ReplyEOF(int tab_handle, int request_id) { | 657 void ExternalTabUITestMockClient::ReplyEOF(int tab_handle, int request_id) { |
| 658 ReplyEnd(URLRequestStatus(), tab_handle, request_id); | 658 ReplyEnd(URLRequestStatus(), tab_handle, request_id); |
| 659 } | 659 } |
| 660 | 660 |
| 661 void ExternalTabUITestMockClient::ReplyEnd(const URLRequestStatus& status, | 661 void ExternalTabUITestMockClient::ReplyEnd(const URLRequestStatus& status, |
| 662 int tab_handle, int request_id) { | 662 int tab_handle, int request_id) { |
| 663 AutomationProxy::Send(new AutomationMsg_RequestEnd(0, tab_handle, | 663 AutomationProxy::Send(new AutomationMsg_RequestEnd(tab_handle, |
| 664 request_id, status)); | 664 request_id, status)); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void ExternalTabUITestMockClient::Reply404(int tab_handle, int request_id) { | 667 void ExternalTabUITestMockClient::Reply404(int tab_handle, int request_id) { |
| 668 const IPC::AutomationURLResponse notfound("", "HTTP/1.1 404\r\n\r\n", 0, | 668 const AutomationURLResponse notfound("", "HTTP/1.1 404\r\n\r\n", 0, |
| 669 base::Time(), "", 0); | 669 base::Time(), "", 0); |
| 670 ReplyStarted(¬found, tab_handle, request_id); | 670 ReplyStarted(¬found, tab_handle, request_id); |
| 671 ReplyEOF(tab_handle, request_id); | 671 ReplyEOF(tab_handle, request_id); |
| 672 } | 672 } |
| 673 | 673 |
| 674 void ExternalTabUITestMockClient::ServeHTMLData(int tab_handle, | 674 void ExternalTabUITestMockClient::ServeHTMLData(int tab_handle, |
| 675 const GURL& url, | 675 const GURL& url, |
| 676 const std::string& data) { | 676 const std::string& data) { |
| 677 EXPECT_CALL(*this, OnRequestStart(tab_handle, _, testing::AllOf( | 677 EXPECT_CALL(*this, OnRequestStart(tab_handle, testing::AllOf( |
| 678 testing::Field(&IPC::AutomationURLRequest::url, url.spec()), | 678 testing::Field(&AutomationURLRequest::url, url.spec()), |
| 679 testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) | 679 testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) |
| 680 .Times(1) | 680 .Times(1) |
| 681 .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, | 681 .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, |
| 682 &ExternalTabUITestMockClient::ReplyStarted, &http_200)))); | 682 &ExternalTabUITestMockClient::ReplyStarted, &http_200)))); |
| 683 | 683 |
| 684 EXPECT_CALL(*this, OnRequestRead(tab_handle, _, testing::Gt(0))) | 684 EXPECT_CALL(*this, OnRequestRead(tab_handle, testing::Gt(0))) |
| 685 .Times(2) | 685 .Times(2) |
| 686 .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, | 686 .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, |
| 687 &ExternalTabUITestMockClient::ReplyData, &data)))) | 687 &ExternalTabUITestMockClient::ReplyData, &data)))) |
| 688 .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(this, | 688 .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(this, |
| 689 &ExternalTabUITestMockClient::ReplyEOF)))); | 689 &ExternalTabUITestMockClient::ReplyEOF)))); |
| 690 } | 690 } |
| 691 | 691 |
| 692 void ExternalTabUITestMockClient::IgnoreFavIconNetworkRequest() { | 692 void ExternalTabUITestMockClient::IgnoreFavIconNetworkRequest() { |
| 693 // Ignore favicon.ico | 693 // Ignore favicon.ico |
| 694 EXPECT_CALL(*this, OnRequestStart(_, _, testing::AllOf( | 694 EXPECT_CALL(*this, OnRequestStart(_, testing::AllOf( |
| 695 testing::Field(&IPC::AutomationURLRequest::url, | 695 testing::Field(&AutomationURLRequest::url, |
| 696 testing::EndsWith("favicon.ico")), | 696 testing::EndsWith("favicon.ico")), |
| 697 testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) | 697 testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) |
| 698 .Times(testing::AnyNumber()) | 698 .Times(testing::AnyNumber()) |
| 699 .WillRepeatedly(testing::WithArgs<0, 1>(testing::Invoke( | 699 .WillRepeatedly(testing::WithArgs<0, 0>(testing::Invoke( |
| 700 CreateFunctor(this, &ExternalTabUITestMockClient::ReplyEnd, | 700 CreateFunctor(this, &ExternalTabUITestMockClient::ReplyEnd, |
| 701 URLRequestStatus(URLRequestStatus::FAILED, 0))))); | 701 URLRequestStatus(URLRequestStatus::FAILED, 0))))); |
| 702 } | 702 } |
| 703 | 703 |
| 704 void ExternalTabUITestMockClient::InvalidateHandle( | 704 void ExternalTabUITestMockClient::InvalidateHandle( |
| 705 const IPC::Message& message) { | 705 const IPC::Message& message) { |
| 706 void* iter = NULL; | 706 void* iter = NULL; |
| 707 int handle; | 707 int handle; |
| 708 ASSERT_TRUE(message.ReadInt(&iter, &handle)); | 708 ASSERT_TRUE(message.ReadInt(&iter, &handle)); |
| 709 | 709 |
| 710 // Call base class | 710 // Call base class |
| 711 AutomationProxy::InvalidateHandle(message); | 711 AutomationProxy::InvalidateHandle(message); |
| 712 HandleClosed(handle); | 712 HandleClosed(handle); |
| 713 } | 713 } |
| 714 | 714 |
| 715 // Most of the time we need external tab with these settings. | 715 // Most of the time we need external tab with these settings. |
| 716 const IPC::ExternalTabSettings ExternalTabUITestMockClient::default_settings( | 716 const ExternalTabSettings ExternalTabUITestMockClient::default_settings( |
| 717 NULL, gfx::Rect(), // will be replaced by CreateHostWindowAndTab | 717 NULL, gfx::Rect(), // will be replaced by CreateHostWindowAndTab |
| 718 WS_CHILD | WS_VISIBLE, | 718 WS_CHILD | WS_VISIBLE, |
| 719 false, // is_off_the_record | 719 false, // is_off_the_record |
| 720 true, // load_requests_via_automation | 720 true, // load_requests_via_automation |
| 721 true, // handle_top_level_requests | 721 true, // handle_top_level_requests |
| 722 GURL(), // initial_url | 722 GURL(), // initial_url |
| 723 GURL(), // referrer | 723 GURL(), // referrer |
| 724 false, // infobars_enabled | 724 false, // infobars_enabled |
| 725 false); // route_all_top_level_navigations | 725 false); // route_all_top_level_navigations |
| 726 | 726 |
| 727 // static | 727 // static |
| 728 const IPC::AutomationURLResponse ExternalTabUITestMockClient::http_200( | 728 const AutomationURLResponse ExternalTabUITestMockClient::http_200( |
| 729 "", | 729 "", |
| 730 "HTTP/0.9 200\r\n\r\n", | 730 "HTTP/0.9 200\r\n\r\n", |
| 731 0, | 731 0, |
| 732 base::Time(), | 732 base::Time(), |
| 733 "", | 733 "", |
| 734 0); | 734 0); |
| 735 | 735 |
| 736 void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { | 736 void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { |
| 737 IPC_BEGIN_MESSAGE_MAP(ExternalTabUITestMockClient, msg) | 737 IPC_BEGIN_MESSAGE_MAP(ExternalTabUITestMockClient, msg) |
| 738 IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) | 738 IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) |
| 739 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, | 739 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, |
| 740 OnForwardMessageToExternalHost) | 740 OnForwardMessageToExternalHost) |
| 741 IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart) | 741 IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnRequestStart) |
| 742 IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead) | 742 IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnRequestRead) |
| 743 IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd) | 743 IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnRequestEnd) |
| 744 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync) | 744 IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookieAsync) |
| 745 IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnLoad) | 745 IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnLoad) |
| 746 IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab) | 746 IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachExternalTab) |
| 747 IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) | 747 IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) |
| 748 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, | 748 IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, |
| 749 OnNavigationStateChanged) | 749 OnNavigationStateChanged) |
| 750 IPC_END_MESSAGE_MAP() | 750 IPC_END_MESSAGE_MAP() |
| 751 } | 751 } |
| 752 | 752 |
| 753 scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( | 753 scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( |
| 754 const IPC::ExternalTabSettings& settings) { | 754 const ExternalTabSettings& settings) { |
| 755 EXPECT_THAT(settings.parent, testing::IsNull()); | 755 EXPECT_THAT(settings.parent, testing::IsNull()); |
| 756 | 756 |
| 757 host_window_ = CreateWindowW(L"Button", NULL, host_window_style_, | 757 host_window_ = CreateWindowW(L"Button", NULL, host_window_style_, |
| 758 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | 758 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
| 759 NULL, NULL, NULL, NULL); | 759 NULL, NULL, NULL, NULL); |
| 760 EXPECT_THAT(host_window_, testing::Truly(::IsWindow)); | 760 EXPECT_THAT(host_window_, testing::Truly(::IsWindow)); |
| 761 RECT client_area = {0}; | 761 RECT client_area = {0}; |
| 762 ::GetClientRect(host_window_, &client_area); | 762 ::GetClientRect(host_window_, &client_area); |
| 763 | 763 |
| 764 IPC::ExternalTabSettings s = settings; | 764 ExternalTabSettings s = settings; |
| 765 s.parent = host_window_; | 765 s.parent = host_window_; |
| 766 s.dimensions = client_area; | 766 s.dimensions = client_area; |
| 767 | 767 |
| 768 HWND container_wnd = NULL; | 768 HWND container_wnd = NULL; |
| 769 HWND tab_wnd = NULL; | 769 HWND tab_wnd = NULL; |
| 770 scoped_refptr<TabProxy> tab(CreateExternalTab(s, &container_wnd, &tab_wnd)); | 770 scoped_refptr<TabProxy> tab(CreateExternalTab(s, &container_wnd, &tab_wnd)); |
| 771 | 771 |
| 772 EXPECT_TRUE(tab != NULL); | 772 EXPECT_TRUE(tab != NULL); |
| 773 EXPECT_NE(FALSE, ::IsWindow(container_wnd)); | 773 EXPECT_NE(FALSE, ::IsWindow(container_wnd)); |
| 774 EXPECT_NE(FALSE, ::IsWindow(tab_wnd)); | 774 EXPECT_NE(FALSE, ::IsWindow(tab_wnd)); |
| 775 return tab; | 775 return tab; |
| 776 } | 776 } |
| 777 | 777 |
| 778 scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithUrl( | 778 scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithUrl( |
| 779 const GURL& initial_url) { | 779 const GURL& initial_url) { |
| 780 IPC::ExternalTabSettings settings = | 780 ExternalTabSettings settings = |
| 781 ExternalTabUITestMockClient::default_settings; | 781 ExternalTabUITestMockClient::default_settings; |
| 782 settings.initial_url = initial_url; | 782 settings.initial_url = initial_url; |
| 783 return CreateHostWindowAndTab(settings); | 783 return CreateHostWindowAndTab(settings); |
| 784 } | 784 } |
| 785 | 785 |
| 786 void ExternalTabUITestMockClient::NavigateInExternalTab(int tab_handle, | 786 void ExternalTabUITestMockClient::NavigateInExternalTab(int tab_handle, |
| 787 const GURL& url, const GURL& referrer /* = GURL()*/) { | 787 const GURL& url, const GURL& referrer /* = GURL()*/) { |
| 788 channel_->ChannelProxy::Send(new AutomationMsg_NavigateInExternalTab(0, | 788 channel_->ChannelProxy::Send(new AutomationMsg_NavigateInExternalTab( |
| 789 tab_handle, url, referrer, NULL)); | 789 tab_handle, url, referrer, NULL)); |
| 790 } | 790 } |
| 791 | 791 |
| 792 void ExternalTabUITestMockClient::ConnectToExternalTab(gfx::NativeWindow parent, | 792 void ExternalTabUITestMockClient::ConnectToExternalTab(gfx::NativeWindow parent, |
| 793 const IPC::AttachExternalTabParams& attach_params) { | 793 const AttachExternalTabParams& attach_params) { |
| 794 gfx::NativeWindow tab_container = NULL; | 794 gfx::NativeWindow tab_container = NULL; |
| 795 gfx::NativeWindow tab_window = NULL; | 795 gfx::NativeWindow tab_window = NULL; |
| 796 int tab_handle = 0; | 796 int tab_handle = 0; |
| 797 int session_id = -1; | 797 int session_id = -1; |
| 798 | 798 |
| 799 IPC::SyncMessage* message = new AutomationMsg_ConnectExternalTab(0, | 799 IPC::SyncMessage* message = new AutomationMsg_ConnectExternalTab( |
| 800 attach_params.cookie, true, NULL, &tab_container, &tab_window, | 800 attach_params.cookie, true, NULL, &tab_container, &tab_window, |
| 801 &tab_handle, &session_id); | 801 &tab_handle, &session_id); |
| 802 channel_->Send(message); | 802 channel_->Send(message); |
| 803 | 803 |
| 804 RECT rect; | 804 RECT rect; |
| 805 ::GetClientRect(parent, &rect); | 805 ::GetClientRect(parent, &rect); |
| 806 IPC::Reposition_Params params = {0}; | 806 Reposition_Params params = {0}; |
| 807 params.window = tab_container; | 807 params.window = tab_container; |
| 808 params.flags = SWP_NOZORDER | SWP_SHOWWINDOW; | 808 params.flags = SWP_NOZORDER | SWP_SHOWWINDOW; |
| 809 params.width = rect.right - rect.left; | 809 params.width = rect.right - rect.left; |
| 810 params.height = rect.bottom - rect.top; | 810 params.height = rect.bottom - rect.top; |
| 811 params.set_parent = true; | 811 params.set_parent = true; |
| 812 params.parent_window = parent; | 812 params.parent_window = parent; |
| 813 | 813 |
| 814 channel_->Send(new AutomationMsg_TabReposition(0, tab_handle, params)); | 814 channel_->Send(new AutomationMsg_TabReposition(tab_handle, params)); |
| 815 ::ShowWindow(parent, SW_SHOWNORMAL); | 815 ::ShowWindow(parent, SW_SHOWNORMAL); |
| 816 } | 816 } |
| 817 | 817 |
| 818 void ExternalTabUITestMockClient::NavigateThroughUserGesture() { | 818 void ExternalTabUITestMockClient::NavigateThroughUserGesture() { |
| 819 ASSERT_THAT(host_window_, testing::Truly(::IsWindow)); | 819 ASSERT_THAT(host_window_, testing::Truly(::IsWindow)); |
| 820 HWND tab_container = ::GetWindow(host_window_, GW_CHILD); | 820 HWND tab_container = ::GetWindow(host_window_, GW_CHILD); |
| 821 ASSERT_THAT(tab_container, testing::Truly(::IsWindow)); | 821 ASSERT_THAT(tab_container, testing::Truly(::IsWindow)); |
| 822 HWND tab = ::GetWindow(tab_container, GW_CHILD); | 822 HWND tab = ::GetWindow(tab_container, GW_CHILD); |
| 823 ASSERT_THAT(tab, testing::Truly(::IsWindow)); | 823 ASSERT_THAT(tab, testing::Truly(::IsWindow)); |
| 824 HWND renderer_window = ::GetWindow(tab, GW_CHILD); | 824 HWND renderer_window = ::GetWindow(tab, GW_CHILD); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 return mock_; | 858 return mock_; |
| 859 } | 859 } |
| 860 | 860 |
| 861 // Create with specifying a url | 861 // Create with specifying a url |
| 862 // Flaky, http://crbug.com/32293 | 862 // Flaky, http://crbug.com/32293 |
| 863 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { | 863 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { |
| 864 scoped_refptr<TabProxy> tab; | 864 scoped_refptr<TabProxy> tab; |
| 865 TimedMessageLoopRunner loop(MessageLoop::current()); | 865 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 866 ASSERT_THAT(mock_, testing::NotNull()); | 866 ASSERT_THAT(mock_, testing::NotNull()); |
| 867 | 867 |
| 868 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 868 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 869 .Times(testing::AnyNumber()); | 869 .Times(testing::AnyNumber()); |
| 870 | 870 |
| 871 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) | 871 EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) |
| 872 .Times(1) | 872 .Times(1) |
| 873 .WillOnce(testing::InvokeWithoutArgs(mock_, | 873 .WillOnce(testing::InvokeWithoutArgs(mock_, |
| 874 &ExternalTabUITestMockClient::DestroyHostWindow)); | 874 &ExternalTabUITestMockClient::DestroyHostWindow)); |
| 875 | 875 |
| 876 EXPECT_CALL(*mock_, HandleClosed(1)) | 876 EXPECT_CALL(*mock_, HandleClosed(1)) |
| 877 .Times(1) | 877 .Times(1) |
| 878 .WillOnce(QUIT_LOOP(&loop)); | 878 .WillOnce(QUIT_LOOP(&loop)); |
| 879 | 879 |
| 880 tab = mock_->CreateTabWithUrl(GURL(simple_data_url)); | 880 tab = mock_->CreateTabWithUrl(GURL(simple_data_url)); |
| 881 loop.RunFor(action_max_timeout_ms()); | 881 loop.RunFor(action_max_timeout_ms()); |
| 882 } | 882 } |
| 883 | 883 |
| 884 // Create with empty url and then navigate | 884 // Create with empty url and then navigate |
| 885 // Flaky, http://crbug.com/32293 | 885 // Flaky, http://crbug.com/32293 |
| 886 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab2) { | 886 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab2) { |
| 887 scoped_refptr<TabProxy> tab; | 887 scoped_refptr<TabProxy> tab; |
| 888 TimedMessageLoopRunner loop(MessageLoop::current()); | 888 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 889 ASSERT_THAT(mock_, testing::NotNull()); | 889 ASSERT_THAT(mock_, testing::NotNull()); |
| 890 | 890 |
| 891 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 891 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 892 .Times(testing::AnyNumber()); | 892 .Times(testing::AnyNumber()); |
| 893 | 893 |
| 894 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) | 894 EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) |
| 895 .Times(1) | 895 .Times(1) |
| 896 .WillOnce(testing::InvokeWithoutArgs(mock_, | 896 .WillOnce(testing::InvokeWithoutArgs(mock_, |
| 897 &ExternalTabUITestMockClient::DestroyHostWindow)); | 897 &ExternalTabUITestMockClient::DestroyHostWindow)); |
| 898 | 898 |
| 899 EXPECT_CALL(*mock_, HandleClosed(1)) | 899 EXPECT_CALL(*mock_, HandleClosed(1)) |
| 900 .Times(1) | 900 .Times(1) |
| 901 .WillOnce(QUIT_LOOP(&loop)); | 901 .WillOnce(QUIT_LOOP(&loop)); |
| 902 | 902 |
| 903 tab = mock_->CreateTabWithUrl(GURL()); | 903 tab = mock_->CreateTabWithUrl(GURL()); |
| 904 mock_->NavigateInExternalTab(tab->handle(), GURL(simple_data_url)); | 904 mock_->NavigateInExternalTab(tab->handle(), GURL(simple_data_url)); |
| 905 loop.RunFor(action_max_timeout_ms()); | 905 loop.RunFor(action_max_timeout_ms()); |
| 906 } | 906 } |
| 907 | 907 |
| 908 // FLAKY: http://crbug.com/60409 | 908 // FLAKY: http://crbug.com/60409 |
| 909 TEST_F(ExternalTabUITest, FLAKY_IncognitoMode) { | 909 TEST_F(ExternalTabUITest, FLAKY_IncognitoMode) { |
| 910 scoped_refptr<TabProxy> tab; | 910 scoped_refptr<TabProxy> tab; |
| 911 TimedMessageLoopRunner loop(MessageLoop::current()); | 911 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 912 ASSERT_THAT(mock_, testing::NotNull()); | 912 ASSERT_THAT(mock_, testing::NotNull()); |
| 913 | 913 |
| 914 GURL url("http://anatomyofmelancholy.net"); | 914 GURL url("http://anatomyofmelancholy.net"); |
| 915 std::string cookie = "robert=burton; expires=Thu, 13 Oct 2011 05:04:03 UTC;"; | 915 std::string cookie = "robert=burton; expires=Thu, 13 Oct 2011 05:04:03 UTC;"; |
| 916 | 916 |
| 917 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); | 917 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); |
| 918 | 918 |
| 919 IPC::ExternalTabSettings incognito = | 919 ExternalTabSettings incognito = |
| 920 ExternalTabUITestMockClient::default_settings; | 920 ExternalTabUITestMockClient::default_settings; |
| 921 incognito.is_off_the_record = true; | 921 incognito.is_off_the_record = true; |
| 922 // SetCookie is a sync call and deadlock can happen if window is visible, | 922 // SetCookie is a sync call and deadlock can happen if window is visible, |
| 923 // since it shares same thread with AutomationProxy. | 923 // since it shares same thread with AutomationProxy. |
| 924 mock_->host_window_style_ &= ~WS_VISIBLE; | 924 mock_->host_window_style_ &= ~WS_VISIBLE; |
| 925 tab = mock_->CreateHostWindowAndTab(incognito); | 925 tab = mock_->CreateHostWindowAndTab(incognito); |
| 926 std::string value_result; | 926 std::string value_result; |
| 927 | 927 |
| 928 EXPECT_TRUE(tab->SetCookie(url, cookie)); | 928 EXPECT_TRUE(tab->SetCookie(url, cookie)); |
| 929 EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result)); | 929 EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 946 CloseBrowserAndServer(); | 946 CloseBrowserAndServer(); |
| 947 tab = NULL; | 947 tab = NULL; |
| 948 } | 948 } |
| 949 | 949 |
| 950 // FLAKY: http://crbug.com/44617 | 950 // FLAKY: http://crbug.com/44617 |
| 951 TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { | 951 TEST_F(ExternalTabUITest, FLAKY_TabPostMessage) { |
| 952 scoped_refptr<TabProxy> tab; | 952 scoped_refptr<TabProxy> tab; |
| 953 TimedMessageLoopRunner loop(MessageLoop::current()); | 953 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 954 ASSERT_THAT(mock_, testing::NotNull()); | 954 ASSERT_THAT(mock_, testing::NotNull()); |
| 955 | 955 |
| 956 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 956 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 957 .Times(testing::AnyNumber()); | 957 .Times(testing::AnyNumber()); |
| 958 EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); | 958 EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); |
| 959 | 959 |
| 960 std::string content = | 960 std::string content = |
| 961 "data:text/html,<html><head><script>" | 961 "data:text/html,<html><head><script>" |
| 962 "function onload() {" | 962 "function onload() {" |
| 963 " window.externalHost.onmessage = onMessage;" | 963 " window.externalHost.onmessage = onMessage;" |
| 964 "}" | 964 "}" |
| 965 "function onMessage(evt) {" | 965 "function onMessage(evt) {" |
| 966 " window.externalHost.postMessage(evt.data, '*');" | 966 " window.externalHost.postMessage(evt.data, '*');" |
| 967 "}" | 967 "}" |
| 968 "</script></head>" | 968 "</script></head>" |
| 969 "<body onload='onload()'>external tab test<br></div>" | 969 "<body onload='onload()'>external tab test<br></div>" |
| 970 "</body></html>"; | 970 "</body></html>"; |
| 971 | 971 |
| 972 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) | 972 EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) |
| 973 .Times(1) | 973 .Times(1) |
| 974 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( | 974 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( |
| 975 ReceivePointer(tab), | 975 ReceivePointer(tab), |
| 976 &TabProxy::HandleMessageFromExternalHost, | 976 &TabProxy::HandleMessageFromExternalHost, |
| 977 std::string("Hello from gtest"), | 977 std::string("Hello from gtest"), |
| 978 std::string("null"), std::string("*")))); | 978 std::string("null"), std::string("*")))); |
| 979 | 979 |
| 980 EXPECT_CALL(*mock_, OnForwardMessageToExternalHost(testing::_, | 980 EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( |
| 981 testing::StrEq("Hello from gtest"), testing::_, testing::_)) | 981 testing::StrEq("Hello from gtest"), testing::_, testing::_)) |
| 982 .Times(1) | 982 .Times(1) |
| 983 .WillOnce(testing::DoAll( | 983 .WillOnce(testing::DoAll( |
| 984 testing::InvokeWithoutArgs(CreateFunctor(mock_, | 984 testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 985 &ExternalTabUITestMockClient::DestroyHostWindow)), | 985 &ExternalTabUITestMockClient::DestroyHostWindow)), |
| 986 QUIT_LOOP_SOON(&loop, 50))); | 986 QUIT_LOOP_SOON(&loop, 50))); |
| 987 | 987 |
| 988 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); | 988 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); |
| 989 | 989 |
| 990 tab = mock_->CreateTabWithUrl(GURL(content)); | 990 tab = mock_->CreateTabWithUrl(GURL(content)); |
| 991 loop.RunFor(action_max_timeout_ms()); | 991 loop.RunFor(action_max_timeout_ms()); |
| 992 } | 992 } |
| 993 | 993 |
| 994 // Flaky: http://crbug.com/62143 | 994 // Flaky: http://crbug.com/62143 |
| 995 TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { | 995 TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { |
| 996 net::TestServer test_server( | 996 net::TestServer test_server( |
| 997 net::TestServer::TYPE_HTTP, | 997 net::TestServer::TYPE_HTTP, |
| 998 FilePath(FILE_PATH_LITERAL("chrome/test/data/external_tab"))); | 998 FilePath(FILE_PATH_LITERAL("chrome/test/data/external_tab"))); |
| 999 ASSERT_TRUE(test_server.Start()); | 999 ASSERT_TRUE(test_server.Start()); |
| 1000 | 1000 |
| 1001 scoped_refptr<TabProxy> tab; | 1001 scoped_refptr<TabProxy> tab; |
| 1002 TimedMessageLoopRunner loop(MessageLoop::current()); | 1002 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 1003 ASSERT_THAT(mock_, testing::NotNull()); | 1003 ASSERT_THAT(mock_, testing::NotNull()); |
| 1004 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 1004 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 1005 .Times(testing::AnyNumber()); | 1005 .Times(testing::AnyNumber()); |
| 1006 EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); | 1006 EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); |
| 1007 | 1007 |
| 1008 std::string kTestMessage("Hello from gtest"); | 1008 std::string kTestMessage("Hello from gtest"); |
| 1009 std::string kTestOrigin("http://www.external.tab"); | 1009 std::string kTestOrigin("http://www.external.tab"); |
| 1010 | 1010 |
| 1011 EXPECT_CALL(*mock_, OnDidNavigate(1, testing::_)) | 1011 EXPECT_CALL(*mock_, OnDidNavigate(testing::_)) |
| 1012 .Times(1) | 1012 .Times(1) |
| 1013 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( | 1013 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( |
| 1014 ReceivePointer(tab), | 1014 ReceivePointer(tab), |
| 1015 &TabProxy::HandleMessageFromExternalHost, | 1015 &TabProxy::HandleMessageFromExternalHost, |
| 1016 kTestMessage, kTestOrigin, std::string("http://localhost:1337/")))); | 1016 kTestMessage, kTestOrigin, std::string("http://localhost:1337/")))); |
| 1017 | 1017 |
| 1018 EXPECT_CALL(*mock_, OnForwardMessageToExternalHost(1, | 1018 EXPECT_CALL(*mock_, OnForwardMessageToExternalHost( |
| 1019 testing::StrEq(kTestMessage), | 1019 testing::StrEq(kTestMessage), |
| 1020 testing::_, | 1020 testing::_, |
| 1021 testing::StrEq(GURL(kTestOrigin).GetOrigin().spec()))) | 1021 testing::StrEq(GURL(kTestOrigin).GetOrigin().spec()))) |
| 1022 .Times(1) | 1022 .Times(1) |
| 1023 .WillOnce(testing::DoAll( | 1023 .WillOnce(testing::DoAll( |
| 1024 testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1024 testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1025 &ExternalTabUITestMockClient::DestroyHostWindow)), | 1025 &ExternalTabUITestMockClient::DestroyHostWindow)), |
| 1026 QUIT_LOOP_SOON(&loop, 50))); | 1026 QUIT_LOOP_SOON(&loop, 50))); |
| 1027 | 1027 |
| 1028 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); | 1028 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); |
| 1029 | 1029 |
| 1030 IPC::ExternalTabSettings s = ExternalTabUITestMockClient::default_settings; | 1030 ExternalTabSettings s = ExternalTabUITestMockClient::default_settings; |
| 1031 s.load_requests_via_automation = false; | 1031 s.load_requests_via_automation = false; |
| 1032 s.initial_url = GURL("http://localhost:1337/files/post_message.html"); | 1032 s.initial_url = GURL("http://localhost:1337/files/post_message.html"); |
| 1033 tab = mock_->CreateHostWindowAndTab(s); | 1033 tab = mock_->CreateHostWindowAndTab(s); |
| 1034 loop.RunFor(action_max_timeout_ms()); | 1034 loop.RunFor(action_max_timeout_ms()); |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 // Flaky, http://crbug.com/42545. | 1037 // Flaky, http://crbug.com/42545. |
| 1038 TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { | 1038 TEST_F(ExternalTabUITest, FLAKY_HostNetworkStack) { |
| 1039 scoped_refptr<TabProxy> tab; | 1039 scoped_refptr<TabProxy> tab; |
| 1040 TimedMessageLoopRunner loop(MessageLoop::current()); | 1040 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 1041 ASSERT_THAT(mock_, testing::NotNull()); | 1041 ASSERT_THAT(mock_, testing::NotNull()); |
| 1042 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 1042 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 1043 .Times(testing::AnyNumber()); | 1043 .Times(testing::AnyNumber()); |
| 1044 EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); | 1044 EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); |
| 1045 | 1045 |
| 1046 std::string url = "http://placetogo.org"; | 1046 std::string url = "http://placetogo.org"; |
| 1047 | 1047 |
| 1048 testing::InSequence sequence; | 1048 testing::InSequence sequence; |
| 1049 EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( | 1049 EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( |
| 1050 testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), | 1050 testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), |
| 1051 testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) | 1051 testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) |
| 1052 .Times(1) | 1052 .Times(1) |
| 1053 // We can simply do CreateFunctor(1, 2, &http_200) since we know the | 1053 // We can simply do CreateFunctor(1, 2, &http_200) since we know the |
| 1054 // tab handle and request id, but using WithArgs<> is much more fancy :) | 1054 // tab handle and request id, but using WithArgs<> is much more fancy :) |
| 1055 .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, | 1055 .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, |
| 1056 &ExternalTabUITestMockClient::ReplyStarted, | 1056 &ExternalTabUITestMockClient::ReplyStarted, |
| 1057 &ExternalTabUITestMockClient::http_200)))); | 1057 &ExternalTabUITestMockClient::http_200)))); |
| 1058 | 1058 |
| 1059 // Return some trivial page, that have a link to a "logo.gif" image | 1059 // Return some trivial page, that have a link to a "logo.gif" image |
| 1060 const std::string data = "<!DOCTYPE html><title>Hello</title>" | 1060 const std::string data = "<!DOCTYPE html><title>Hello</title>" |
| 1061 "<img src=\"logo.gif\">"; | 1061 "<img src=\"logo.gif\">"; |
| 1062 | 1062 |
| 1063 EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) | 1063 EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) |
| 1064 .Times(2) | 1064 .Times(2) |
| 1065 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1065 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1066 &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))) | 1066 &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))) |
| 1067 .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, | 1067 .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, |
| 1068 &ExternalTabUITestMockClient::ReplyEOF)))); | 1068 &ExternalTabUITestMockClient::ReplyEOF)))); |
| 1069 | 1069 |
| 1070 // Expect navigation is ok. | 1070 // Expect navigation is ok. |
| 1071 EXPECT_CALL(*mock_, OnDidNavigate(1, testing::Field(&IPC::NavigationInfo::url, | 1071 EXPECT_CALL(*mock_, OnDidNavigate(testing::Field(&NavigationInfo::url, |
| 1072 GURL(url)))) | 1072 GURL(url)))) |
| 1073 .Times(1); | 1073 .Times(1); |
| 1074 | 1074 |
| 1075 // Expect GET request for logo.gif | 1075 // Expect GET request for logo.gif |
| 1076 EXPECT_CALL(*mock_, OnRequestStart(1, 3, testing::AllOf( | 1076 EXPECT_CALL(*mock_, OnRequestStart(3, testing::AllOf( |
| 1077 testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/logo.gif")), | 1077 testing::Field(&AutomationURLRequest::url, StrEq(url + "/logo.gif")), |
| 1078 testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) | 1078 testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) |
| 1079 .Times(1) | 1079 .Times(1) |
| 1080 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1080 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1081 &ExternalTabUITestMockClient::Reply404, 1, 3))); | 1081 &ExternalTabUITestMockClient::Reply404, 1, 3))); |
| 1082 | 1082 |
| 1083 EXPECT_CALL(*mock_, OnRequestRead(1, 3, testing::Gt(0))) | 1083 EXPECT_CALL(*mock_, OnRequestRead(3, testing::Gt(0))) |
| 1084 .Times(1); | 1084 .Times(1); |
| 1085 | 1085 |
| 1086 // Chrome makes a brave request for favicon.ico | 1086 // Chrome makes a brave request for favicon.ico |
| 1087 EXPECT_CALL(*mock_, OnRequestStart(1, 4, testing::AllOf( | 1087 EXPECT_CALL(*mock_, OnRequestStart(4, testing::AllOf( |
| 1088 testing::Field(&IPC::AutomationURLRequest::url, | 1088 testing::Field(&AutomationURLRequest::url, |
| 1089 StrEq(url + "/favicon.ico")), | 1089 StrEq(url + "/favicon.ico")), |
| 1090 testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) | 1090 testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) |
| 1091 .Times(1) | 1091 .Times(1) |
| 1092 .WillOnce(testing::DoAll( | 1092 .WillOnce(testing::DoAll( |
| 1093 testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1093 testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1094 &ExternalTabUITestMockClient::Reply404, 1, 4)), | 1094 &ExternalTabUITestMockClient::Reply404, 1, 4)), |
| 1095 testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1095 testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1096 &ExternalTabUITestMockClient::DestroyHostWindow)))); | 1096 &ExternalTabUITestMockClient::DestroyHostWindow)))); |
| 1097 | 1097 |
| 1098 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); | 1098 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); |
| 1099 | 1099 |
| 1100 EXPECT_CALL(*mock_, OnRequestRead(1, 4, testing::Gt(0))) | 1100 EXPECT_CALL(*mock_, OnRequestRead(4, testing::Gt(0))) |
| 1101 .Times(1) | 1101 .Times(1) |
| 1102 .WillOnce(QUIT_LOOP_SOON(&loop, 300)); | 1102 .WillOnce(QUIT_LOOP_SOON(&loop, 300)); |
| 1103 | 1103 |
| 1104 tab = mock_->CreateTabWithUrl(GURL(url)); | 1104 tab = mock_->CreateTabWithUrl(GURL(url)); |
| 1105 loop.RunFor(action_max_timeout_ms()); | 1105 loop.RunFor(action_max_timeout_ms()); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 // Flaky, http://crbug.com/61023. | 1108 // Flaky, http://crbug.com/61023. |
| 1109 TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackAbortRequest) { | 1109 TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackAbortRequest) { |
| 1110 scoped_refptr<TabProxy> tab; | 1110 scoped_refptr<TabProxy> tab; |
| 1111 TimedMessageLoopRunner loop(MessageLoop::current()); | 1111 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 1112 ASSERT_THAT(mock_, testing::NotNull()); | 1112 ASSERT_THAT(mock_, testing::NotNull()); |
| 1113 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 1113 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 1114 .Times(testing::AnyNumber()); | 1114 .Times(testing::AnyNumber()); |
| 1115 | 1115 |
| 1116 std::string url = "http://placetogo.org"; | 1116 std::string url = "http://placetogo.org"; |
| 1117 | 1117 |
| 1118 testing::InSequence sequence; | 1118 testing::InSequence sequence; |
| 1119 EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( | 1119 EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( |
| 1120 testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), | 1120 testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), |
| 1121 testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) | 1121 testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) |
| 1122 .Times(1) | 1122 .Times(1) |
| 1123 // We can simply do CreateFunctor(1, 2, &http_200) since we know the | 1123 // We can simply do CreateFunctor(1, 2, &http_200) since we know the |
| 1124 // tab handle and request id, but using WithArgs<> is much more fancy :) | 1124 // tab handle and request id, but using WithArgs<> is much more fancy :) |
| 1125 .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, | 1125 .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, |
| 1126 &ExternalTabUITestMockClient::ReplyStarted, | 1126 &ExternalTabUITestMockClient::ReplyStarted, |
| 1127 &ExternalTabUITestMockClient::http_200)))); | 1127 &ExternalTabUITestMockClient::http_200)))); |
| 1128 | 1128 |
| 1129 // Return some trivial page, that have a link to a "logo.gif" image | 1129 // Return some trivial page, that have a link to a "logo.gif" image |
| 1130 const std::string data = "<!DOCTYPE html><title>Hello"; | 1130 const std::string data = "<!DOCTYPE html><title>Hello"; |
| 1131 | 1131 |
| 1132 EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) | 1132 EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) |
| 1133 .Times(2) | 1133 .Times(2) |
| 1134 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1134 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1135 &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))) | 1135 &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))) |
| 1136 .WillOnce(testing::WithArgs<0, 1>( | 1136 .WillOnce(testing::WithArgs<0, 0>( |
| 1137 testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1137 testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1138 &ExternalTabUITestMockClient::DestroyHostWindow)))); | 1138 &ExternalTabUITestMockClient::DestroyHostWindow)))); |
| 1139 | 1139 |
| 1140 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); | 1140 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); |
| 1141 | 1141 |
| 1142 EXPECT_CALL(*mock_, OnRequestEnd(1, 2, testing::_)) | 1142 EXPECT_CALL(*mock_, OnRequestEnd(2, testing::_)) |
| 1143 .Times(1) | 1143 .Times(1) |
| 1144 .WillOnce(QUIT_LOOP_SOON(&loop, 300)); | 1144 .WillOnce(QUIT_LOOP_SOON(&loop, 300)); |
| 1145 | 1145 |
| 1146 tab = mock_->CreateTabWithUrl(GURL(url)); | 1146 tab = mock_->CreateTabWithUrl(GURL(url)); |
| 1147 loop.RunFor(action_max_timeout_ms()); | 1147 loop.RunFor(action_max_timeout_ms()); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 // Flaky, http://crbug.com/61023. | 1150 // Flaky, http://crbug.com/61023. |
| 1151 TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { | 1151 TEST_F(ExternalTabUITest, FLAKY_HostNetworkStackUnresponsiveRenderer) { |
| 1152 scoped_refptr<TabProxy> tab; | 1152 scoped_refptr<TabProxy> tab; |
| 1153 TimedMessageLoopRunner loop(MessageLoop::current()); | 1153 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 1154 ASSERT_THAT(mock_, testing::NotNull()); | 1154 ASSERT_THAT(mock_, testing::NotNull()); |
| 1155 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 1155 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 1156 .Times(testing::AnyNumber()); | 1156 .Times(testing::AnyNumber()); |
| 1157 EXPECT_CALL(*mock_, OnLoad(_, _)).Times(testing::AnyNumber()); | 1157 EXPECT_CALL(*mock_, OnLoad(_)).Times(testing::AnyNumber()); |
| 1158 | 1158 |
| 1159 std::string url = "http://placetogo.org"; | 1159 std::string url = "http://placetogo.org"; |
| 1160 | 1160 |
| 1161 EXPECT_CALL(*mock_, OnRequestStart(1, 3, testing::_)) | 1161 EXPECT_CALL(*mock_, OnRequestStart(3, testing::_)) |
| 1162 .Times(testing::AnyNumber()); | 1162 .Times(testing::AnyNumber()); |
| 1163 EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); | 1163 EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); |
| 1164 | 1164 |
| 1165 testing::InSequence sequence; | 1165 testing::InSequence sequence; |
| 1166 EXPECT_CALL(*mock_, OnRequestStart(1, 2, testing::AllOf( | 1166 EXPECT_CALL(*mock_, OnRequestStart(2, testing::AllOf( |
| 1167 testing::Field(&IPC::AutomationURLRequest::url, StrEq(url + "/")), | 1167 testing::Field(&AutomationURLRequest::url, StrEq(url + "/")), |
| 1168 testing::Field(&IPC::AutomationURLRequest::method, StrEq("GET"))))) | 1168 testing::Field(&AutomationURLRequest::method, StrEq("GET"))))) |
| 1169 .Times(1) | 1169 .Times(1) |
| 1170 // We can simply do CreateFunctor(1, 2, &http_200) since we know the | 1170 // We can simply do CreateFunctor(1, 2, &http_200) since we know the |
| 1171 // tab handle and request id, but using WithArgs<> is much more fancy :) | 1171 // tab handle and request id, but using WithArgs<> is much more fancy :) |
| 1172 .WillOnce(testing::WithArgs<0, 1>(testing::Invoke(CreateFunctor(mock_, | 1172 .WillOnce(testing::WithArgs<0, 0>(testing::Invoke(CreateFunctor(mock_, |
| 1173 &ExternalTabUITestMockClient::ReplyStarted, | 1173 &ExternalTabUITestMockClient::ReplyStarted, |
| 1174 &ExternalTabUITestMockClient::http_200)))); | 1174 &ExternalTabUITestMockClient::http_200)))); |
| 1175 | 1175 |
| 1176 const std::string head = "<html><title>Hello</title><body>"; | 1176 const std::string head = "<html><title>Hello</title><body>"; |
| 1177 | 1177 |
| 1178 const std::string data = "<table border=\"1\"><tr><th>Month</th>" | 1178 const std::string data = "<table border=\"1\"><tr><th>Month</th>" |
| 1179 "<th>Savings</th></tr><tr><td>January</td>" | 1179 "<th>Savings</th></tr><tr><td>January</td>" |
| 1180 "<td>$100</td></tr><tr><td>February</td>" | 1180 "<td>$100</td></tr><tr><td>February</td>" |
| 1181 "<td>$100</td></tr><tr><td>March</td>" | 1181 "<td>$100</td></tr><tr><td>March</td>" |
| 1182 "<td>$100</td></tr><tr><td>April</td>" | 1182 "<td>$100</td></tr><tr><td>April</td>" |
| 1183 "<td>$100</td></tr><tr><td>May</td>" | 1183 "<td>$100</td></tr><tr><td>May</td>" |
| 1184 "<td>$100</td></tr><tr><td>June</td>" | 1184 "<td>$100</td></tr><tr><td>June</td>" |
| 1185 "<td>$100</td></tr><tr><td>July</td>" | 1185 "<td>$100</td></tr><tr><td>July</td>" |
| 1186 "<td>$100</td></tr><tr><td>Aug</td>" | 1186 "<td>$100</td></tr><tr><td>Aug</td>" |
| 1187 "<td>$100</td></tr><tr><td>Sept</td>" | 1187 "<td>$100</td></tr><tr><td>Sept</td>" |
| 1188 "<td>$100</td></tr><tr><td>Oct</td>" | 1188 "<td>$100</td></tr><tr><td>Oct</td>" |
| 1189 "<td>$100</td></tr><tr><td>Nov</td>" | 1189 "<td>$100</td></tr><tr><td>Nov</td>" |
| 1190 "<td>$100</td></tr><tr><td>Dec</td>" | 1190 "<td>$100</td></tr><tr><td>Dec</td>" |
| 1191 "<td>$100</td></tr></table>"; | 1191 "<td>$100</td></tr></table>"; |
| 1192 | 1192 |
| 1193 const std::string tail = "</body></html>"; | 1193 const std::string tail = "</body></html>"; |
| 1194 | 1194 |
| 1195 EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) | 1195 EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) |
| 1196 .Times(1) | 1196 .Times(1) |
| 1197 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1197 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1198 &ExternalTabUITestMockClient::ReplyData, &head, 1, 2))); | 1198 &ExternalTabUITestMockClient::ReplyData, &head, 1, 2))); |
| 1199 | 1199 |
| 1200 EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) | 1200 EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) |
| 1201 .Times(100) | 1201 .Times(100) |
| 1202 .WillRepeatedly(testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1202 .WillRepeatedly(testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1203 &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))); | 1203 &ExternalTabUITestMockClient::ReplyData, &data, 1, 2))); |
| 1204 | 1204 |
| 1205 EXPECT_CALL(*mock_, OnRequestRead(1, 2, testing::Gt(0))) | 1205 EXPECT_CALL(*mock_, OnRequestRead(2, testing::Gt(0))) |
| 1206 .Times(testing::AnyNumber()) | 1206 .Times(testing::AnyNumber()) |
| 1207 .WillOnce(testing::DoAll( | 1207 .WillOnce(testing::DoAll( |
| 1208 testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1208 testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1209 &ExternalTabUITestMockClient::ReplyData, &tail, 1, 2)), | 1209 &ExternalTabUITestMockClient::ReplyData, &tail, 1, 2)), |
| 1210 testing::InvokeWithoutArgs(CreateFunctor(mock_, | 1210 testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 1211 &ExternalTabUITestMockClient::ReplyEOF, 1, 2)), | 1211 &ExternalTabUITestMockClient::ReplyEOF, 1, 2)), |
| 1212 QUIT_LOOP_SOON(&loop, 300))); | 1212 QUIT_LOOP_SOON(&loop, 300))); |
| 1213 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); | 1213 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); |
| 1214 | 1214 |
| 1215 tab = mock_->CreateTabWithUrl(GURL(url)); | 1215 tab = mock_->CreateTabWithUrl(GURL(url)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1234 #endif | 1234 #endif |
| 1235 | 1235 |
| 1236 // Testing AutomationMsg_AttachExternalTab callback from Chrome. | 1236 // Testing AutomationMsg_AttachExternalTab callback from Chrome. |
| 1237 // Open a popup window with window.open() call. The created popup window opens | 1237 // Open a popup window with window.open() call. The created popup window opens |
| 1238 // another popup window (again using window.open() call). | 1238 // another popup window (again using window.open() call). |
| 1239 TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { | 1239 TEST_F(ExternalTabUITestPopupEnabled, MAYBE_WindowDotOpen) { |
| 1240 TimedMessageLoopRunner loop(MessageLoop::current()); | 1240 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 1241 ASSERT_THAT(mock_, testing::NotNull()); | 1241 ASSERT_THAT(mock_, testing::NotNull()); |
| 1242 mock_->IgnoreFavIconNetworkRequest(); | 1242 mock_->IgnoreFavIconNetworkRequest(); |
| 1243 // Ignore navigation state changes. | 1243 // Ignore navigation state changes. |
| 1244 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 1244 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 1245 .Times(testing::AnyNumber()); | 1245 .Times(testing::AnyNumber()); |
| 1246 EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); | 1246 EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); |
| 1247 | 1247 |
| 1248 GURL main_url("http://placetogo.com/"); | 1248 GURL main_url("http://placetogo.com/"); |
| 1249 std::string main_html = | 1249 std::string main_html = |
| 1250 "<html><head><script type='text/javascript' language='JavaScript'>" | 1250 "<html><head><script type='text/javascript' language='JavaScript'>" |
| 1251 "window.open('popup1.html','','toolbar=no,menubar=no,location=yes," | 1251 "window.open('popup1.html','','toolbar=no,menubar=no,location=yes," |
| 1252 "height=320,width=300,left=1');" | 1252 "height=320,width=300,left=1');" |
| 1253 "</script></head><body>Main.</body></html>"; | 1253 "</script></head><body>Main.</body></html>"; |
| 1254 mock_->ServeHTMLData(1, main_url, main_html); | 1254 mock_->ServeHTMLData(1, main_url, main_html); |
| 1255 EXPECT_CALL(*mock_, OnLoad(1, _)).Times(1); | 1255 EXPECT_CALL(*mock_, OnLoad(_)).Times(1); |
| 1256 | 1256 |
| 1257 GURL popup1_url("http://placetogo.com/popup1.html"); | 1257 GURL popup1_url("http://placetogo.com/popup1.html"); |
| 1258 std::string popup1_html = | 1258 std::string popup1_html = |
| 1259 "<html><head><script type='text/javascript' language='JavaScript'>" | 1259 "<html><head><script type='text/javascript' language='JavaScript'>" |
| 1260 "window.open('popup2.html','','');" | 1260 "window.open('popup2.html','','');" |
| 1261 "</script></head><body>Popup1.</body></html>"; | 1261 "</script></head><body>Popup1.</body></html>"; |
| 1262 mock_->ServeHTMLData(2, popup1_url, popup1_html); | 1262 mock_->ServeHTMLData(2, popup1_url, popup1_html); |
| 1263 EXPECT_CALL(*mock_, OnLoad(2, _)).Times(1); | 1263 EXPECT_CALL(*mock_, OnLoad(_)).Times(1); |
| 1264 | 1264 |
| 1265 GURL popup2_url("http://placetogo.com/popup2.html"); | 1265 GURL popup2_url("http://placetogo.com/popup2.html"); |
| 1266 std::string popup2_html = "<html><body>Popup2.</body></html>"; | 1266 std::string popup2_html = "<html><body>Popup2.</body></html>"; |
| 1267 mock_->ServeHTMLData(3, popup2_url, popup2_html); | 1267 mock_->ServeHTMLData(3, popup2_url, popup2_html); |
| 1268 EXPECT_CALL(*mock_, OnLoad(3, _)).Times(1) | 1268 EXPECT_CALL(*mock_, OnLoad(_)).Times(1) |
| 1269 .WillOnce(QUIT_LOOP_SOON(&loop, 500)); | 1269 .WillOnce(QUIT_LOOP_SOON(&loop, 500)); |
| 1270 | 1270 |
| 1271 DWORD style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; | 1271 DWORD style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; |
| 1272 HWND popup1_host = CreateWindowW(L"Button", L"popup1_host", style, | 1272 HWND popup1_host = CreateWindowW(L"Button", L"popup1_host", style, |
| 1273 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | 1273 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
| 1274 NULL, NULL, NULL, NULL); | 1274 NULL, NULL, NULL, NULL); |
| 1275 | 1275 |
| 1276 HWND popup2_host = CreateWindowW(L"Button", L"popup2_host", style, | 1276 HWND popup2_host = CreateWindowW(L"Button", L"popup2_host", style, |
| 1277 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | 1277 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
| 1278 NULL, NULL, NULL, NULL); | 1278 NULL, NULL, NULL, NULL); |
| 1279 | 1279 |
| 1280 EXPECT_CALL(*mock_, OnAttachExternalTab(1, _)) | 1280 EXPECT_CALL(*mock_, OnAttachExternalTab(_)) |
| 1281 .Times(1) | 1281 .Times(1) |
| 1282 .WillOnce(testing::WithArgs<1>(testing::Invoke(CreateFunctor(mock_, | 1282 .WillOnce(testing::WithArgs<0>(testing::Invoke(CreateFunctor(mock_, |
| 1283 &ExternalTabUITestMockClient::ConnectToExternalTab, popup1_host)))); | 1283 &ExternalTabUITestMockClient::ConnectToExternalTab, popup1_host)))); |
| 1284 | 1284 |
| 1285 EXPECT_CALL(*mock_, OnAttachExternalTab(2, _)) | 1285 EXPECT_CALL(*mock_, OnAttachExternalTab(_)) |
| 1286 .Times(1) | 1286 .Times(1) |
| 1287 .WillOnce(testing::WithArgs<1>(testing::Invoke(CreateFunctor(mock_, | 1287 .WillOnce(testing::WithArgs<0>(testing::Invoke(CreateFunctor(mock_, |
| 1288 &ExternalTabUITestMockClient::ConnectToExternalTab, popup2_host)))); | 1288 &ExternalTabUITestMockClient::ConnectToExternalTab, popup2_host)))); |
| 1289 | 1289 |
| 1290 mock_->CreateTabWithUrl(main_url); | 1290 mock_->CreateTabWithUrl(main_url); |
| 1291 | 1291 |
| 1292 loop.RunFor(action_max_timeout_ms()); | 1292 loop.RunFor(action_max_timeout_ms()); |
| 1293 | 1293 |
| 1294 EXPECT_CALL(*mock_, HandleClosed(1)); | 1294 EXPECT_CALL(*mock_, HandleClosed(1)); |
| 1295 EXPECT_CALL(*mock_, HandleClosed(2)); | 1295 EXPECT_CALL(*mock_, HandleClosed(2)); |
| 1296 EXPECT_CALL(*mock_, HandleClosed(3)); | 1296 EXPECT_CALL(*mock_, HandleClosed(3)); |
| 1297 | 1297 |
| 1298 mock_->DestroyHostWindow(); | 1298 mock_->DestroyHostWindow(); |
| 1299 ::DestroyWindow(popup1_host); | 1299 ::DestroyWindow(popup1_host); |
| 1300 ::DestroyWindow(popup2_host); | 1300 ::DestroyWindow(popup2_host); |
| 1301 } | 1301 } |
| 1302 | 1302 |
| 1303 // Open a new window by simulating a user gesture through keyboard. | 1303 // Open a new window by simulating a user gesture through keyboard. |
| 1304 TEST_F(ExternalTabUITestPopupEnabled, MAYBE_UserGestureTargetBlank) { | 1304 TEST_F(ExternalTabUITestPopupEnabled, MAYBE_UserGestureTargetBlank) { |
| 1305 TimedMessageLoopRunner loop(MessageLoop::current()); | 1305 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 1306 ASSERT_THAT(mock_, testing::NotNull()); | 1306 ASSERT_THAT(mock_, testing::NotNull()); |
| 1307 mock_->IgnoreFavIconNetworkRequest(); | 1307 mock_->IgnoreFavIconNetworkRequest(); |
| 1308 // Ignore navigation state changes. | 1308 // Ignore navigation state changes. |
| 1309 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 1309 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _)) |
| 1310 .Times(testing::AnyNumber()); | 1310 .Times(testing::AnyNumber()); |
| 1311 EXPECT_CALL(*mock_, OnDidNavigate(_, _)).Times(testing::AnyNumber()); | 1311 EXPECT_CALL(*mock_, OnDidNavigate(_)).Times(testing::AnyNumber()); |
| 1312 | 1312 |
| 1313 GURL main_url("http://placetogo.com/"); | 1313 GURL main_url("http://placetogo.com/"); |
| 1314 std::string main_html = "<!DOCTYPE html><title>Hello</title>" | 1314 std::string main_html = "<!DOCTYPE html><title>Hello</title>" |
| 1315 "<a href='http://foo.com/' target='_blank'>Link</a>"; | 1315 "<a href='http://foo.com/' target='_blank'>Link</a>"; |
| 1316 mock_->ServeHTMLData(1, main_url, main_html); | 1316 mock_->ServeHTMLData(1, main_url, main_html); |
| 1317 | 1317 |
| 1318 HWND foo_host = CreateWindowW(L"Button", L"foo_host", | 1318 HWND foo_host = CreateWindowW(L"Button", L"foo_host", |
| 1319 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, | 1319 WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, |
| 1320 CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); | 1320 CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); |
| 1321 | 1321 |
| 1322 testing::InSequence s; | 1322 testing::InSequence s; |
| 1323 EXPECT_CALL(*mock_, OnLoad(1, _)) | 1323 EXPECT_CALL(*mock_, OnLoad(_)) |
| 1324 .WillOnce(testing::InvokeWithoutArgs(testing::CreateFunctor(mock_, | 1324 .WillOnce(testing::InvokeWithoutArgs(testing::CreateFunctor(mock_, |
| 1325 &ExternalTabUITestMockClient::NavigateThroughUserGesture))); | 1325 &ExternalTabUITestMockClient::NavigateThroughUserGesture))); |
| 1326 | 1326 |
| 1327 EXPECT_CALL(*mock_, OnAttachExternalTab(1, _)) | 1327 EXPECT_CALL(*mock_, OnAttachExternalTab(_)) |
| 1328 .Times(1) | 1328 .Times(1) |
| 1329 .WillOnce(QUIT_LOOP_SOON(&loop, 500)); | 1329 .WillOnce(QUIT_LOOP_SOON(&loop, 500)); |
| 1330 | 1330 |
| 1331 mock_->CreateTabWithUrl(main_url); | 1331 mock_->CreateTabWithUrl(main_url); |
| 1332 loop.RunFor(action_max_timeout_ms()); | 1332 loop.RunFor(action_max_timeout_ms()); |
| 1333 | 1333 |
| 1334 EXPECT_CALL(*mock_, HandleClosed(1)); | 1334 EXPECT_CALL(*mock_, HandleClosed(1)); |
| 1335 ::DestroyWindow(foo_host); | 1335 ::DestroyWindow(foo_host); |
| 1336 mock_->DestroyHostWindow(); | 1336 mock_->DestroyHostWindow(); |
| 1337 } | 1337 } |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 int diff_pixels_count = 0; | 1709 int diff_pixels_count = 0; |
| 1710 for (int x = 0; x < img_size.width(); ++x) { | 1710 for (int x = 0; x < img_size.width(); ++x) { |
| 1711 for (int y = 0; y < img_size.height(); ++y) { | 1711 for (int y = 0; y < img_size.height(); ++y) { |
| 1712 if (*snapshot_bmp.getAddr32(x, y) != *reference_bmp.getAddr32(x, y)) { | 1712 if (*snapshot_bmp.getAddr32(x, y) != *reference_bmp.getAddr32(x, y)) { |
| 1713 ++diff_pixels_count; | 1713 ++diff_pixels_count; |
| 1714 } | 1714 } |
| 1715 } | 1715 } |
| 1716 } | 1716 } |
| 1717 ASSERT_EQ(diff_pixels_count, 0); | 1717 ASSERT_EQ(diff_pixels_count, 0); |
| 1718 } | 1718 } |
| OLD | NEW |