| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 file_util::AppendToPath(&document2_, L"title2.html"); | 394 file_util::AppendToPath(&document2_, L"title2.html"); |
| 395 launch_arguments_ = CommandLine(L""); | 395 launch_arguments_ = CommandLine(L""); |
| 396 launch_arguments_.AppendLooseValue(document1_); | 396 launch_arguments_.AppendLooseValue(document1_); |
| 397 launch_arguments_.AppendLooseValue(document2_); | 397 launch_arguments_.AppendLooseValue(document2_); |
| 398 } | 398 } |
| 399 | 399 |
| 400 std::wstring document1_; | 400 std::wstring document1_; |
| 401 std::wstring document2_; | 401 std::wstring document2_; |
| 402 }; | 402 }; |
| 403 | 403 |
| 404 // TODO(port): Port to mac. |
| 405 #if defined(OS_WIN) || defined(OS_LINUX) |
| 404 TEST_F(AutomationProxyTest2, GetActiveTabIndex) { | 406 TEST_F(AutomationProxyTest2, GetActiveTabIndex) { |
| 405 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 407 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 406 ASSERT_TRUE(window.get()); | 408 ASSERT_TRUE(window.get()); |
| 407 | 409 |
| 408 int active_tab_index = -1; | 410 int active_tab_index = -1; |
| 409 ASSERT_TRUE(window->GetActiveTabIndex(&active_tab_index)); | 411 ASSERT_TRUE(window->GetActiveTabIndex(&active_tab_index)); |
| 410 int tab_count; | 412 int tab_count; |
| 411 ASSERT_TRUE(window->GetTabCount(&tab_count)); | 413 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
| 412 ASSERT_EQ(0, active_tab_index); | 414 ASSERT_EQ(0, active_tab_index); |
| 413 int at_index = 1; | 415 int at_index = 1; |
| 414 ASSERT_TRUE(window->ActivateTab(at_index)); | 416 ASSERT_TRUE(window->ActivateTab(at_index)); |
| 415 ASSERT_TRUE(window->GetActiveTabIndex(&active_tab_index)); | 417 ASSERT_TRUE(window->GetActiveTabIndex(&active_tab_index)); |
| 416 ASSERT_EQ(at_index, active_tab_index); | 418 ASSERT_EQ(at_index, active_tab_index); |
| 417 } | 419 } |
| 418 | 420 |
| 419 // TODO(port): Port to mac. | |
| 420 #if defined(OS_WIN) || defined(OS_LINUX) | |
| 421 TEST_F(AutomationProxyTest2, GetTabTitle) { | 421 TEST_F(AutomationProxyTest2, GetTabTitle) { |
| 422 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 422 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 423 ASSERT_TRUE(window.get()); | 423 ASSERT_TRUE(window.get()); |
| 424 scoped_ptr<TabProxy> tab(window->GetTab(0)); | 424 scoped_ptr<TabProxy> tab(window->GetTab(0)); |
| 425 ASSERT_TRUE(tab.get()); | 425 ASSERT_TRUE(tab.get()); |
| 426 std::wstring title; | 426 std::wstring title; |
| 427 ASSERT_TRUE(tab->GetTabTitle(&title)); | 427 ASSERT_TRUE(tab->GetTabTitle(&title)); |
| 428 ASSERT_STREQ(L"title1.html", title.c_str()); | 428 ASSERT_STREQ(L"title1.html", title.c_str()); |
| 429 | 429 |
| 430 tab.reset(window->GetTab(1)); | 430 tab.reset(window->GetTab(1)); |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 | 1159 |
| 1160 // Allow some time for the popup to show up and close. | 1160 // Allow some time for the popup to show up and close. |
| 1161 PlatformThread::Sleep(2000); | 1161 PlatformThread::Sleep(2000); |
| 1162 | 1162 |
| 1163 std::wstring expected(L"string"); | 1163 std::wstring expected(L"string"); |
| 1164 std::wstring jscript = CreateJSString(L"\"" + expected + L"\""); | 1164 std::wstring jscript = CreateJSString(L"\"" + expected + L"\""); |
| 1165 std::wstring actual; | 1165 std::wstring actual; |
| 1166 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); | 1166 ASSERT_TRUE(tab->ExecuteAndExtractString(L"", jscript, &actual)); |
| 1167 ASSERT_STREQ(expected.c_str(), actual.c_str()); | 1167 ASSERT_STREQ(expected.c_str(), actual.c_str()); |
| 1168 } | 1168 } |
| OLD | NEW |