OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/message_box_flags.h" | 9 #include "app/message_box_flags.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/compiler_specific.h" |
11 #include "base/file_path.h" | 12 #include "base/file_path.h" |
12 #include "base/gfx/rect.h" | 13 #include "base/gfx/rect.h" |
13 #include "base/string_util.h" | 14 #include "base/string_util.h" |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
15 #include "chrome/app/chrome_dll_resource.h" | 16 #include "chrome/app/chrome_dll_resource.h" |
16 #include "chrome/browser/net/url_request_slow_http_job.h" | 17 #include "chrome/browser/net/url_request_slow_http_job.h" |
17 #include "chrome/browser/view_ids.h" | 18 #include "chrome/browser/view_ids.h" |
18 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/json_value_serializer.h" | 21 #include "chrome/common/json_value_serializer.h" |
21 #include "chrome/test/automation/autocomplete_edit_proxy.h" | 22 #include "chrome/test/automation/autocomplete_edit_proxy.h" |
22 #include "chrome/test/automation/automation_messages.h" | 23 #include "chrome/test/automation/automation_messages.h" |
23 #include "chrome/test/automation/automation_proxy_uitest.h" | 24 #include "chrome/test/automation/automation_proxy_uitest.h" |
24 #include "chrome/test/automation/browser_proxy.h" | 25 #include "chrome/test/automation/browser_proxy.h" |
25 #include "chrome/test/automation/tab_proxy.h" | 26 #include "chrome/test/automation/tab_proxy.h" |
26 #include "chrome/test/automation/window_proxy.h" | 27 #include "chrome/test/automation/window_proxy.h" |
| 28 #include "chrome/test/ui_test_utils.h" |
27 #include "chrome/test/ui/ui_test.h" | 29 #include "chrome/test/ui/ui_test.h" |
28 #include "net/base/net_util.h" | 30 #include "net/base/net_util.h" |
29 #include "net/url_request/url_request_unittest.h" | 31 #include "net/url_request/url_request_unittest.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" |
| 33 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING |
| 34 #include "testing/gmock_mutant.h" |
30 #include "views/event.h" | 35 #include "views/event.h" |
31 | 36 |
| 37 using ui_test_utils::TimedMessageLoopRunner; |
| 38 using testing::CreateFunctor; |
| 39 |
32 #if defined(OS_MACOSX) | 40 #if defined(OS_MACOSX) |
33 #define MAYBE_WindowGetViewBounds DISABLED_WindowGetViewBounds | 41 #define MAYBE_WindowGetViewBounds DISABLED_WindowGetViewBounds |
34 #else | 42 #else |
35 #define MAYBE_WindowGetViewBounds WindowGetViewBounds | 43 #define MAYBE_WindowGetViewBounds WindowGetViewBounds |
36 #endif | 44 #endif |
37 | 45 |
38 class AutomationProxyTest : public UITest { | 46 class AutomationProxyTest : public UITest { |
39 protected: | 47 protected: |
40 AutomationProxyTest() { | 48 AutomationProxyTest() { |
41 dom_automation_enabled_ = true; | 49 dom_automation_enabled_ = true; |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 const std::string& target) { | 847 const std::string& target) { |
840 messages_received_++; | 848 messages_received_++; |
841 message_ = message; | 849 message_ = message; |
842 origin_ = origin; | 850 origin_ = origin; |
843 target_ = target; | 851 target_ = target; |
844 | 852 |
845 if (QUIT_AFTER_MESSAGE == quit_after_) | 853 if (QUIT_AFTER_MESSAGE == quit_after_) |
846 QuitLoop(); | 854 QuitLoop(); |
847 } | 855 } |
848 | 856 |
849 GURL simple_data_url = GURL(std::string( | 857 const char simple_data_url[] = |
850 "data:text/html,<html><head><title>External tab test</title></head>" | 858 "data:text/html,<html><head><title>External tab test</title></head>" |
851 "<body>A simple page for testing a floating/invisible tab<br></div>" | 859 "<body>A simple page for testing a floating/invisible tab<br></div>" |
852 "</body></html>")); | 860 "</body></html>"; |
| 861 |
| 862 // We have to derive from AutomationProxy in order to hook up |
| 863 // OnMessageReceived callbacks. |
| 864 class ExternalTabUITestMockClient : public AutomationProxy { |
| 865 public: |
| 866 explicit ExternalTabUITestMockClient(int execution_timeout) |
| 867 : AutomationProxy(execution_timeout), |
| 868 host_window_(NULL) { |
| 869 } |
| 870 |
| 871 MOCK_METHOD2(OnDidNavigate, void(int tab_handle, |
| 872 const IPC::NavigationInfo& nav_info)); |
| 873 MOCK_METHOD4(OnForwardMessageToExternalHost, void(int handle, |
| 874 const std::string& message, const std::string& origin, |
| 875 const std::string& target)); |
| 876 MOCK_METHOD1(HandleClosed, void(int handle)); |
| 877 |
| 878 scoped_refptr<TabProxy> CreateTabWithHostWindow( |
| 879 bool is_incognito, const GURL& initial_url); |
| 880 void DestroyHostWindow(); |
| 881 |
| 882 protected: |
| 883 HWND host_window_; |
| 884 |
| 885 // Simple dispatcher to above OnXXX methods. |
| 886 virtual void OnMessageReceived(const IPC::Message& msg); |
| 887 virtual void InvalidateHandle(const IPC::Message& message) { |
| 888 void* iter = NULL; |
| 889 int handle; |
| 890 ASSERT_TRUE(message.ReadInt(&iter, &handle)); |
| 891 |
| 892 // Call base class |
| 893 AutomationProxy::InvalidateHandle(message); |
| 894 HandleClosed(handle); |
| 895 } |
| 896 }; |
| 897 |
| 898 void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { |
| 899 IPC_BEGIN_MESSAGE_MAP(ExternalTabUITestMockClient, msg) |
| 900 IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) |
| 901 IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, |
| 902 OnForwardMessageToExternalHost) |
| 903 IPC_END_MESSAGE_MAP() |
| 904 } |
| 905 |
| 906 scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateTabWithHostWindow( |
| 907 bool is_incognito, const GURL& initial_url) { |
| 908 |
| 909 DWORD style = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; |
| 910 host_window_ = CreateWindowW(L"Static", NULL, style, |
| 911 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, NULL, NULL); |
| 912 |
| 913 EXPECT_THAT(host_window_, testing::Truly(::IsWindow)); |
| 914 |
| 915 RECT client_area = {0}; |
| 916 ::GetClientRect(host_window_, &client_area); |
| 917 |
| 918 const IPC::ExternalTabSettings settings = { |
| 919 host_window_, |
| 920 gfx::Rect(client_area), |
| 921 WS_CHILD | WS_VISIBLE, |
| 922 is_incognito, |
| 923 false, |
| 924 false, |
| 925 initial_url |
| 926 }; |
| 927 |
| 928 HWND container_wnd = NULL; |
| 929 HWND tab_wnd = NULL; |
| 930 scoped_refptr<TabProxy> tab(CreateExternalTab(settings, &container_wnd, |
| 931 &tab_wnd)); |
| 932 |
| 933 EXPECT_TRUE(tab != NULL); |
| 934 EXPECT_NE(FALSE, ::IsWindow(container_wnd)); |
| 935 EXPECT_NE(FALSE, ::IsWindow(tab_wnd)); |
| 936 return tab; |
| 937 } |
| 938 |
| 939 void ExternalTabUITestMockClient::DestroyHostWindow() { |
| 940 ::DestroyWindow(host_window_); |
| 941 } |
| 942 |
| 943 // Handy macro |
| 944 #define QUIT_LOOP(loop) testing::InvokeWithoutArgs(\ |
| 945 CreateFunctor(loop, &TimedMessageLoopRunner::Quit)) |
| 946 #define QUIT_LOOP_SOON(loop, ms) testing::InvokeWithoutArgs(\ |
| 947 CreateFunctor(loop, &TimedMessageLoopRunner::QuitAfter, ms)) |
| 948 |
| 949 template <typename T> T** ReceivePointer(scoped_ptr<T>& p) { // NOLINT |
| 950 return reinterpret_cast<T**>(&p); |
| 951 } |
| 952 |
| 953 template <typename T> T** ReceivePointer(scoped_refptr<T>& p) { // NOLINT |
| 954 return reinterpret_cast<T**>(&p); |
| 955 } |
| 956 |
| 957 AutomationProxy* ExternalTabUITest::CreateAutomationProxy(int exec_timeout) { |
| 958 mock_ = new ExternalTabUITestMockClient(exec_timeout); |
| 959 return mock_; |
| 960 } |
853 | 961 |
854 // Create with specifying a url | 962 // Create with specifying a url |
855 TEST_F(ExternalTabTestType, CreateExternalTab1) { | 963 TEST_F(ExternalTabUITest, CreateExternalTab1) { |
856 AutomationProxyForExternalTab* proxy = | 964 scoped_refptr<TabProxy> tab; |
857 static_cast<AutomationProxyForExternalTab*>(automation()); | 965 TimedMessageLoopRunner loop(MessageLoop::current()); |
858 HWND external_tab_container = NULL; | 966 ASSERT_THAT(mock_, testing::NotNull()); |
859 HWND tab_wnd = NULL; | |
860 scoped_refptr<TabProxy> tab(proxy->CreateTabWithHostWindow(false, | |
861 simple_data_url, &external_tab_container, &tab_wnd)); | |
862 | 967 |
863 EXPECT_TRUE(tab->is_valid()); | 968 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) |
864 if (tab != NULL) { | 969 .Times(1) |
865 EXPECT_TRUE(proxy->WaitForNavigation(action_max_timeout_ms())); | 970 .WillOnce(testing::InvokeWithoutArgs(mock_, |
| 971 &ExternalTabUITestMockClient::DestroyHostWindow)); |
866 | 972 |
867 proxy->DestroyHostWindow(); | 973 EXPECT_CALL(*mock_, HandleClosed(1)) |
868 proxy->WaitForTabCleanup(tab, action_max_timeout_ms()); | 974 .Times(1) |
| 975 .WillOnce(QUIT_LOOP(&loop)); |
869 | 976 |
870 EXPECT_FALSE(tab->is_valid()); | 977 tab = mock_->CreateTabWithHostWindow(false, GURL(simple_data_url)); |
871 EXPECT_EQ(FALSE, ::IsWindow(external_tab_container)); | 978 loop.RunFor(2 * action_max_timeout_ms()); |
872 EXPECT_EQ(FALSE, ::IsWindow(tab_wnd)); | |
873 } | |
874 } | 979 } |
875 | 980 |
876 // Create with empty url and then navigate | 981 // Create with empty url and then navigate |
877 TEST_F(ExternalTabTestType, CreateExternalTab2) { | 982 TEST_F(ExternalTabUITest, CreateExternalTab2) { |
878 AutomationProxyForExternalTab* proxy = | 983 scoped_refptr<TabProxy> tab; |
879 static_cast<AutomationProxyForExternalTab*>(automation()); | 984 TimedMessageLoopRunner loop(MessageLoop::current()); |
880 HWND external_tab_container = NULL; | 985 ASSERT_THAT(mock_, testing::NotNull()); |
881 HWND tab_wnd = NULL; | |
882 scoped_refptr<TabProxy> tab(proxy->CreateTabWithHostWindow(false, | |
883 GURL(), &external_tab_container, &tab_wnd)); | |
884 | 986 |
885 // Enter a message loop to allow the tab to be created | 987 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) |
886 proxy->WaitForNavigation(2000); | 988 .Times(1) |
887 EXPECT_TRUE(tab->is_valid()); | 989 .WillOnce(testing::InvokeWithoutArgs(mock_, |
| 990 &ExternalTabUITestMockClient::DestroyHostWindow)); |
888 | 991 |
889 if (tab != NULL) { | 992 EXPECT_CALL(*mock_, HandleClosed(1)) |
890 // Wait for navigation | 993 .Times(1) |
891 tab->NavigateInExternalTab(simple_data_url, GURL()); | 994 .WillOnce(QUIT_LOOP(&loop)); |
892 EXPECT_TRUE(proxy->WaitForNavigation(action_max_timeout_ms())); | |
893 | 995 |
894 // Now destroy the external tab | 996 tab = mock_->CreateTabWithHostWindow(false, GURL()); |
895 proxy->DestroyHostWindow(); | 997 tab->NavigateInExternalTab(GURL(simple_data_url), GURL()); |
896 proxy->WaitForTabCleanup(tab, action_max_timeout_ms()); | 998 loop.RunFor(2 * action_max_timeout_ms()); |
897 | |
898 EXPECT_FALSE(tab->is_valid()); | |
899 EXPECT_EQ(FALSE, ::IsWindow(external_tab_container)); | |
900 EXPECT_EQ(FALSE, ::IsWindow(tab_wnd)); | |
901 } | |
902 } | 999 } |
903 | 1000 |
904 // Freezes randomly causing the entire ui test to hang | 1001 TEST_F(ExternalTabUITest, IncognitoMode) { |
905 // http://code.google.com/p/chromium/issues/detail?id=24664 | 1002 scoped_refptr<TabProxy> tab; |
906 TEST_F(ExternalTabTestType, DISABLED_IncognitoMode) { | 1003 TimedMessageLoopRunner loop(MessageLoop::current()); |
907 AutomationProxyForExternalTab* proxy = | 1004 ASSERT_THAT(mock_, testing::NotNull()); |
908 static_cast<AutomationProxyForExternalTab*>(automation()); | |
909 HWND external_tab_container = NULL; | |
910 HWND tab_wnd = NULL; | |
911 | 1005 |
912 // Create incognito tab | 1006 |
913 GURL url("http://anatomyofmelancholy.net"); | 1007 GURL url("http://anatomyofmelancholy.net"); |
914 scoped_refptr<TabProxy> tab(proxy->CreateTabWithHostWindow(true, url, | 1008 tab = mock_->CreateTabWithHostWindow(true, GURL()); |
915 &external_tab_container, &tab_wnd)); | |
916 EXPECT_TRUE(proxy->WaitForNavigation(action_max_timeout_ms())); | |
917 | |
918 std::string value_result; | 1009 std::string value_result; |
919 | 1010 |
920 EXPECT_TRUE(tab->SetCookie(url, "robert=burton; " | 1011 EXPECT_TRUE(tab->SetCookie(url, "robert=burton; " |
921 "expires=Thu, 13 Oct 2011 05:04:03 UTC;")); | 1012 "expires=Thu, 13 Oct 2011 05:04:03 UTC;")); |
922 EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result)); | 1013 EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result)); |
923 EXPECT_EQ("burton", value_result); | 1014 EXPECT_EQ("burton", value_result); |
924 proxy->DestroyHostWindow(); | 1015 mock_->DestroyHostWindow(); |
925 CloseBrowserAndServer(); | 1016 CloseBrowserAndServer(); |
926 tab = NULL; | 1017 tab = NULL; |
927 | 1018 |
928 value_result.clear(); | 1019 value_result.clear(); |
929 clear_profile_ = false; | 1020 clear_profile_ = false; |
930 external_tab_container = NULL; | |
931 tab_wnd = NULL; | |
932 LaunchBrowserAndServer(); | 1021 LaunchBrowserAndServer(); |
933 tab = proxy->CreateTabWithHostWindow(false, url, &external_tab_container, | 1022 tab = mock_->CreateTabWithHostWindow(false, GURL()); |
934 &tab_wnd); | |
935 EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result)); | 1023 EXPECT_TRUE(tab->GetCookieByName(url, "robert", &value_result)); |
936 EXPECT_EQ("", value_result); | 1024 EXPECT_EQ("", value_result); |
937 } | 1025 } |
938 | 1026 |
939 TEST_F(ExternalTabTestType, DISABLED_ExternalTabPostMessage) { | 1027 TEST_F(ExternalTabUITest, TabPostMessage) { |
940 AutomationProxyForExternalTab* proxy = | 1028 scoped_refptr<TabProxy> tab; |
941 static_cast<AutomationProxyForExternalTab*>(automation()); | 1029 TimedMessageLoopRunner loop(MessageLoop::current()); |
942 HWND external_tab_container = NULL; | 1030 ASSERT_THAT(mock_, testing::NotNull()); |
943 HWND tab_wnd = NULL; | 1031 |
944 std::string content = | 1032 std::string content = |
945 "data:text/html,<html><head><script>" | 1033 "data:text/html,<html><head><script>" |
946 "function onload() {" | 1034 "function onload() {" |
947 " window.externalHost.onmessage = onMessage;" | 1035 " window.externalHost.onmessage = onMessage;" |
948 "}" | 1036 "}" |
949 "function onMessage(evt) {" | 1037 "function onMessage(evt) {" |
950 " window.externalHost.postMessage(evt.data, '*');" | 1038 " window.externalHost.postMessage(evt.data, '*');" |
951 "}" | 1039 "}" |
952 "</script></head>" | 1040 "</script></head>" |
953 "<body onload='onload()'>external tab test<br></div>" | 1041 "<body onload='onload()'>external tab test<br></div>" |
954 "</body></html>"; | 1042 "</body></html>"; |
955 scoped_refptr<TabProxy> tab(proxy->CreateTabWithHostWindow(false, | |
956 GURL(content), &external_tab_container, &tab_wnd)); | |
957 | 1043 |
958 if (tab != NULL) { | 1044 EXPECT_CALL(*mock_, OnDidNavigate(testing::_, testing::_)) |
959 // Wait for navigation | 1045 .Times(1) |
960 EXPECT_TRUE(proxy->WaitForNavigation(action_max_timeout_ms())); | 1046 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( |
| 1047 ReceivePointer(tab), |
| 1048 &TabProxy::HandleMessageFromExternalHost, |
| 1049 std::string("Hello from gtest"), |
| 1050 std::string("null"), std::string("*")))); |
961 | 1051 |
962 tab->HandleMessageFromExternalHost("Hello from gtest", "null", "*"); | 1052 EXPECT_CALL(*mock_, OnForwardMessageToExternalHost(testing::_, |
963 EXPECT_TRUE(proxy->WaitForMessage(5000)); | 1053 testing::StrEq("Hello from gtest"), testing::_, testing::_)) |
| 1054 .Times(1) |
| 1055 .WillOnce(QUIT_LOOP_SOON(&loop, 50)); |
964 | 1056 |
965 EXPECT_NE(0, proxy->messages_received()); | |
966 | 1057 |
967 if (proxy->messages_received()) { | 1058 tab = mock_->CreateTabWithHostWindow(false, GURL(content)); |
968 EXPECT_EQ("Hello from gtest", proxy->message()); | 1059 loop.RunFor(2 * action_max_timeout_ms()); |
969 } | |
970 } | |
971 } | 1060 } |
972 | 1061 |
973 TEST_F(ExternalTabTestType, DISABLED_ExternalTabPostMessageTarget) { | 1062 TEST_F(ExternalTabUITest, PostMessageTarget) { |
974 const wchar_t kDocRoot[] = L"chrome/test/data/external_tab"; | 1063 const wchar_t kDocRoot[] = L"chrome/test/data/external_tab"; |
975 scoped_refptr<HTTPTestServer> server( | 1064 scoped_refptr<HTTPTestServer> server( |
976 HTTPTestServer::CreateServer(kDocRoot, NULL)); | 1065 HTTPTestServer::CreateServer(kDocRoot, NULL)); |
| 1066 ASSERT_THAT(server.get(), testing::NotNull()); |
977 | 1067 |
978 const char kTestUrl[] = "http://localhost:1337/files/post_message.html"; | 1068 scoped_refptr<TabProxy> tab; |
| 1069 TimedMessageLoopRunner loop(MessageLoop::current()); |
| 1070 ASSERT_THAT(mock_, testing::NotNull()); |
979 | 1071 |
980 AutomationProxyForExternalTab* proxy = | 1072 std::string kTestMessage("Hello from gtest"); |
981 static_cast<AutomationProxyForExternalTab*>(automation()); | 1073 std::string kTestOrigin("http://www.external.tab"); |
982 HWND external_tab_container = NULL; | |
983 HWND tab_wnd = NULL; | |
984 scoped_refptr<TabProxy> tab(proxy->CreateTabWithHostWindow(false, | |
985 GURL(kTestUrl), &external_tab_container, &tab_wnd)); | |
986 | 1074 |
987 if (tab != NULL) { | 1075 EXPECT_CALL(*mock_, OnDidNavigate(1, testing::_)) |
988 EXPECT_TRUE(proxy->WaitForNavigation(action_max_timeout_ms())); | 1076 .Times(1) |
| 1077 .WillOnce(testing::InvokeWithoutArgs(CreateFunctor( |
| 1078 ReceivePointer(tab), |
| 1079 &TabProxy::HandleMessageFromExternalHost, |
| 1080 kTestMessage, kTestOrigin, std::string("http://localhost:1337/")))); |
989 | 1081 |
990 // Post a message to the page, specifying a target. | 1082 EXPECT_CALL(*mock_, OnForwardMessageToExternalHost(1, |
991 // If the page receives it, it will post the same message right back to us. | 1083 testing::StrEq(kTestMessage), |
992 const char kTestMessage[] = "Hello from gtest"; | 1084 testing::_, |
993 const char kTestOrigin[] = "http://www.external.tab"; | 1085 testing::StrEq(GURL(kTestOrigin).GetOrigin().spec()))) |
994 tab->HandleMessageFromExternalHost(kTestMessage, kTestOrigin, | 1086 .Times(1) |
995 "http://localhost:1337/"); | 1087 .WillOnce(QUIT_LOOP_SOON(&loop, 50)); |
996 | 1088 |
997 EXPECT_TRUE(proxy->WaitForMessage(5000)); | |
998 EXPECT_NE(0, proxy->messages_received()); | |
999 | 1089 |
1000 if (proxy->messages_received()) { | 1090 tab = mock_->CreateTabWithHostWindow(false, |
1001 EXPECT_EQ(kTestMessage, proxy->message()); | 1091 GURL("http://localhost:1337/files/post_message.html")); |
1002 EXPECT_EQ(GURL(kTestOrigin).GetOrigin(), GURL(proxy->target())); | 1092 |
1003 } | 1093 loop.RunFor(2 * action_max_timeout_ms()); |
1004 } | |
1005 } | 1094 } |
1006 #endif // defined(OS_WIN) | 1095 #endif // defined(OS_WIN) |
1007 | 1096 |
1008 // TODO(port): Need to port autocomplete_edit_proxy.* first. | 1097 // TODO(port): Need to port autocomplete_edit_proxy.* first. |
1009 #if defined(OS_WIN) || defined(OS_LINUX) | 1098 #if defined(OS_WIN) || defined(OS_LINUX) |
1010 TEST_F(AutomationProxyTest, AutocompleteGetSetText) { | 1099 TEST_F(AutomationProxyTest, AutocompleteGetSetText) { |
1011 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 1100 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
1012 ASSERT_TRUE(browser.get()); | 1101 ASSERT_TRUE(browser.get()); |
1013 scoped_refptr<AutocompleteEditProxy> edit( | 1102 scoped_refptr<AutocompleteEditProxy> edit( |
1014 browser->GetAutocompleteEdit()); | 1103 browser->GetAutocompleteEdit()); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 | 1271 |
1183 // Allow some time for the popup to show up and close. | 1272 // Allow some time for the popup to show up and close. |
1184 PlatformThread::Sleep(2000); | 1273 PlatformThread::Sleep(2000); |
1185 | 1274 |
1186 std::wstring expected(L"string"); | 1275 std::wstring expected(L"string"); |
1187 std::wstring jscript = CreateJSString(L"\"" + expected + L"\""); | 1276 std::wstring jscript = CreateJSString(L"\"" + expected + L"\""); |
1188 std::wstring actual; | 1277 std::wstring actual; |
1189 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); | 1278 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); |
1190 ASSERT_EQ(expected, actual); | 1279 ASSERT_EQ(expected, actual); |
1191 } | 1280 } |
OLD | NEW |