| 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/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/app/chrome_dll_resource.h" | 14 #include "chrome/app/chrome_dll_resource.h" |
| 15 #include "chrome/browser/view_ids.h" | 15 #include "chrome/browser/view_ids.h" |
| 16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/common/json_value_serializer.h" | 18 #include "chrome/common/json_value_serializer.h" |
| 19 #include "chrome/test/automation/automation_proxy_uitest.h" | 19 #include "chrome/test/automation/automation_proxy_uitest.h" |
| 20 #include "chrome/test/automation/browser_proxy.h" | 20 #include "chrome/test/automation/browser_proxy.h" |
| 21 #include "chrome/test/automation/tab_proxy.h" | 21 #include "chrome/test/automation/tab_proxy.h" |
| 22 #include "chrome/test/automation/window_proxy.h" | 22 #include "chrome/test/automation/window_proxy.h" |
| 23 #include "chrome/test/ui/ui_test.h" | 23 #include "chrome/test/ui/ui_test.h" |
| 24 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
| 25 #include "views/event.h" | 25 #include "views/event.h" |
| 26 | 26 |
| 27 // http://code.google.com/p/chromium/issues/detail?id=14943 |
| 28 #if defined(OS_LINUX) |
| 29 #define MAYBE_NavigateToURLWithTimeout2 DISABLED_NavigateToURLWithTimeout2 |
| 30 #else |
| 31 #define MAYBE_NavigateToURLWithTimeout2 NavigateToURLWithTimeout2 |
| 32 #endif |
| 33 |
| 27 class AutomationProxyTest : public UITest { | 34 class AutomationProxyTest : public UITest { |
| 28 protected: | 35 protected: |
| 29 AutomationProxyTest() { | 36 AutomationProxyTest() { |
| 30 dom_automation_enabled_ = true; | 37 dom_automation_enabled_ = true; |
| 31 launch_arguments_.AppendSwitchWithValue(switches::kLang, | 38 launch_arguments_.AppendSwitchWithValue(switches::kLang, |
| 32 L"en-us"); | 39 L"en-us"); |
| 33 } | 40 } |
| 34 }; | 41 }; |
| 35 | 42 |
| 36 TEST_F(AutomationProxyTest, GetBrowserWindowCount) { | 43 TEST_F(AutomationProxyTest, GetBrowserWindowCount) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 292 |
| 286 std::wstring title; | 293 std::wstring title; |
| 287 ASSERT_TRUE(tab->GetTabTitle(&title)); | 294 ASSERT_TRUE(tab->GetTabTitle(&title)); |
| 288 ASSERT_STREQ(L"Title Of Awesomeness", title.c_str()); | 295 ASSERT_STREQ(L"Title Of Awesomeness", title.c_str()); |
| 289 | 296 |
| 290 tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename), | 297 tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename), |
| 291 1, &is_timeout); | 298 1, &is_timeout); |
| 292 ASSERT_TRUE(is_timeout); | 299 ASSERT_TRUE(is_timeout); |
| 293 } | 300 } |
| 294 | 301 |
| 295 TEST_F(AutomationProxyTest, NavigateToURLWithTimeout2) { | 302 TEST_F(AutomationProxyTest, MAYBE_NavigateToURLWithTimeout2) { |
| 296 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 303 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 297 ASSERT_TRUE(window.get()); | 304 ASSERT_TRUE(window.get()); |
| 298 scoped_refptr<TabProxy> tab(window->GetTab(0)); | 305 scoped_refptr<TabProxy> tab(window->GetTab(0)); |
| 299 ASSERT_TRUE(tab.get()); | 306 ASSERT_TRUE(tab.get()); |
| 300 | 307 |
| 301 FilePath filename1(test_data_directory_); | 308 FilePath filename1(test_data_directory_); |
| 302 filename1 = filename1.AppendASCII("title1.html"); | 309 filename1 = filename1.AppendASCII("title1.html"); |
| 303 | 310 |
| 304 bool is_timeout; | 311 bool is_timeout; |
| 305 tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename1), | 312 tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename1), |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 | 1031 |
| 1025 // Allow some time for the popup to show up and close. | 1032 // Allow some time for the popup to show up and close. |
| 1026 PlatformThread::Sleep(2000); | 1033 PlatformThread::Sleep(2000); |
| 1027 | 1034 |
| 1028 std::wstring expected(L"string"); | 1035 std::wstring expected(L"string"); |
| 1029 std::wstring jscript = CreateJSString(L"\"" + expected + L"\""); | 1036 std::wstring jscript = CreateJSString(L"\"" + expected + L"\""); |
| 1030 std::wstring actual; | 1037 std::wstring actual; |
| 1031 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); | 1038 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); |
| 1032 ASSERT_EQ(expected, actual); | 1039 ASSERT_EQ(expected, actual); |
| 1033 } | 1040 } |
| OLD | NEW |