| 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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 template <typename T> T** ReceivePointer(scoped_refptr<T>& p) { // NOLINT | 833 template <typename T> T** ReceivePointer(scoped_refptr<T>& p) { // NOLINT |
| 834 return reinterpret_cast<T**>(&p); | 834 return reinterpret_cast<T**>(&p); |
| 835 } | 835 } |
| 836 | 836 |
| 837 AutomationProxy* ExternalTabUITest::CreateAutomationProxy(int exec_timeout) { | 837 AutomationProxy* ExternalTabUITest::CreateAutomationProxy(int exec_timeout) { |
| 838 mock_ = new ExternalTabUITestMockClient(exec_timeout); | 838 mock_ = new ExternalTabUITestMockClient(exec_timeout); |
| 839 return mock_; | 839 return mock_; |
| 840 } | 840 } |
| 841 | 841 |
| 842 // Create with specifying a url | 842 // Create with specifying a url |
| 843 // Flaky, http://crbug.com/32293. | 843 // Flaky, http://crbug.com/32293 |
| 844 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { | 844 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab1) { |
| 845 scoped_refptr<TabProxy> tab; | 845 scoped_refptr<TabProxy> tab; |
| 846 TimedMessageLoopRunner loop(MessageLoop::current()); | 846 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 847 ASSERT_THAT(mock_, testing::NotNull()); | 847 ASSERT_THAT(mock_, testing::NotNull()); |
| 848 | 848 |
| 849 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 849 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) |
| 850 .Times(testing::AnyNumber()); | 850 .Times(testing::AnyNumber()); |
| 851 | 851 |
| 852 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) | 852 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) |
| 853 .Times(1) | 853 .Times(1) |
| 854 .WillOnce(testing::InvokeWithoutArgs(mock_, | 854 .WillOnce(testing::InvokeWithoutArgs(mock_, |
| 855 &ExternalTabUITestMockClient::DestroyHostWindow)); | 855 &ExternalTabUITestMockClient::DestroyHostWindow)); |
| 856 | 856 |
| 857 EXPECT_CALL(*mock_, HandleClosed(1)) | 857 EXPECT_CALL(*mock_, HandleClosed(1)) |
| 858 .Times(1) | 858 .Times(1) |
| 859 .WillOnce(QUIT_LOOP(&loop)); | 859 .WillOnce(QUIT_LOOP(&loop)); |
| 860 | 860 |
| 861 tab = mock_->CreateTabWithUrl(GURL(simple_data_url)); | 861 tab = mock_->CreateTabWithUrl(GURL(simple_data_url)); |
| 862 loop.RunFor(action_max_timeout_ms()); | 862 loop.RunFor(action_max_timeout_ms()); |
| 863 } | 863 } |
| 864 | 864 |
| 865 // Create with empty url and then navigate | 865 // Create with empty url and then navigate |
| 866 // Flaky, http://crbug.com/32293 |
| 866 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab2) { | 867 TEST_F(ExternalTabUITest, FLAKY_CreateExternalTab2) { |
| 867 scoped_refptr<TabProxy> tab; | 868 scoped_refptr<TabProxy> tab; |
| 868 TimedMessageLoopRunner loop(MessageLoop::current()); | 869 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 869 ASSERT_THAT(mock_, testing::NotNull()); | 870 ASSERT_THAT(mock_, testing::NotNull()); |
| 870 | 871 |
| 871 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 872 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) |
| 872 .Times(testing::AnyNumber()); | 873 .Times(testing::AnyNumber()); |
| 873 | 874 |
| 874 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) | 875 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) |
| 875 .Times(1) | 876 .Times(1) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 testing::InvokeWithoutArgs(CreateFunctor(mock_, | 965 testing::InvokeWithoutArgs(CreateFunctor(mock_, |
| 965 &ExternalTabUITestMockClient::DestroyHostWindow)), | 966 &ExternalTabUITestMockClient::DestroyHostWindow)), |
| 966 QUIT_LOOP_SOON(&loop, 50))); | 967 QUIT_LOOP_SOON(&loop, 50))); |
| 967 | 968 |
| 968 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); | 969 EXPECT_CALL(*mock_, HandleClosed(1)).Times(1); |
| 969 | 970 |
| 970 tab = mock_->CreateTabWithUrl(GURL(content)); | 971 tab = mock_->CreateTabWithUrl(GURL(content)); |
| 971 loop.RunFor(action_max_timeout_ms()); | 972 loop.RunFor(action_max_timeout_ms()); |
| 972 } | 973 } |
| 973 | 974 |
| 975 // Flaky: http://crbug.com/62143 |
| 974 TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { | 976 TEST_F(ExternalTabUITest, FLAKY_PostMessageTarget) { |
| 975 net::TestServer test_server( | 977 net::TestServer test_server( |
| 976 net::TestServer::TYPE_HTTP, | 978 net::TestServer::TYPE_HTTP, |
| 977 FilePath(FILE_PATH_LITERAL("chrome/test/data/external_tab"))); | 979 FilePath(FILE_PATH_LITERAL("chrome/test/data/external_tab"))); |
| 978 ASSERT_TRUE(test_server.Start()); | 980 ASSERT_TRUE(test_server.Start()); |
| 979 | 981 |
| 980 scoped_refptr<TabProxy> tab; | 982 scoped_refptr<TabProxy> tab; |
| 981 TimedMessageLoopRunner loop(MessageLoop::current()); | 983 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 982 ASSERT_THAT(mock_, testing::NotNull()); | 984 ASSERT_THAT(mock_, testing::NotNull()); |
| 983 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) | 985 EXPECT_CALL(*mock_, OnNavigationStateChanged(_, _, _)) |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 | 1505 |
| 1504 // Allow some time for the popup to show up and close. | 1506 // Allow some time for the popup to show up and close. |
| 1505 PlatformThread::Sleep(sleep_timeout_ms()); | 1507 PlatformThread::Sleep(sleep_timeout_ms()); |
| 1506 | 1508 |
| 1507 std::wstring expected(L"string"); | 1509 std::wstring expected(L"string"); |
| 1508 std::wstring jscript = CreateJSString(L"\"" + expected + L"\""); | 1510 std::wstring jscript = CreateJSString(L"\"" + expected + L"\""); |
| 1509 std::wstring actual; | 1511 std::wstring actual; |
| 1510 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); | 1512 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); |
| 1511 ASSERT_EQ(expected, actual); | 1513 ASSERT_EQ(expected, actual); |
| 1512 } | 1514 } |
| OLD | NEW |