| 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 <oleacc.h> | 5 #include <oleacc.h> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/win_util.h" | 8 #include "base/win_util.h" |
| 9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
| 10 #include "chrome/common/l10n_util.h" | 10 #include "chrome/common/l10n_util.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 GetState(acc_obj)); | 133 GetState(acc_obj)); |
| 134 | 134 |
| 135 // Now check Back status in different situations. | 135 // Now check Back status in different situations. |
| 136 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 136 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 137 ASSERT_TRUE(window.get()); | 137 ASSERT_TRUE(window.get()); |
| 138 int tab_count = -1; | 138 int tab_count = -1; |
| 139 | 139 |
| 140 // Set URL and check button status. | 140 // Set URL and check button status. |
| 141 scoped_ptr<TabProxy> tab1(window->GetTab(0)); | 141 scoped_ptr<TabProxy> tab1(window->GetTab(0)); |
| 142 ASSERT_TRUE(tab1.get()); | 142 ASSERT_TRUE(tab1.get()); |
| 143 std::wstring test_file1 = test_data_directory_; | 143 FilePath test_file1(FilePath::FromWStringHack(test_data_directory_)); |
| 144 file_util::AppendToPath(&test_file1, L"title1.html"); | 144 test_file1 = test_file1.AppendASCII("title1.html"); |
| 145 tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); | 145 tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); |
| 146 Sleep(sleep_timeout_ms()); | 146 Sleep(sleep_timeout_ms()); |
| 147 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE, | 147 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE, |
| 148 GetState(acc_obj)); | 148 GetState(acc_obj)); |
| 149 // Go Back and check status. | 149 // Go Back and check status. |
| 150 window->ApplyAccelerator(IDC_BACK); | 150 window->ApplyAccelerator(IDC_BACK); |
| 151 Sleep(sleep_timeout_ms()); | 151 Sleep(sleep_timeout_ms()); |
| 152 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | | 152 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | |
| 153 STATE_SYSTEM_FOCUSABLE | | 153 STATE_SYSTEM_FOCUSABLE | |
| 154 STATE_SYSTEM_UNAVAILABLE, | 154 STATE_SYSTEM_UNAVAILABLE, |
| 155 GetState(acc_obj)); | 155 GetState(acc_obj)); |
| 156 | 156 |
| 157 // Add empty new tab and check status. | 157 // Add empty new tab and check status. |
| 158 ASSERT_TRUE(window->GetTabCount(&tab_count)); | 158 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
| 159 ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB)); | 159 ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB)); |
| 160 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, | 160 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, |
| 161 action_max_timeout_ms())); | 161 action_max_timeout_ms())); |
| 162 // Check accessibility object's children. | 162 // Check accessibility object's children. |
| 163 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | | 163 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | |
| 164 STATE_SYSTEM_FOCUSABLE | | 164 STATE_SYSTEM_FOCUSABLE | |
| 165 STATE_SYSTEM_UNAVAILABLE, | 165 STATE_SYSTEM_UNAVAILABLE, |
| 166 GetState(acc_obj)); | 166 GetState(acc_obj)); |
| 167 | 167 |
| 168 // Add new tab with URL and check status. | 168 // Add new tab with URL and check status. |
| 169 ASSERT_TRUE(window->GetTabCount(&tab_count)); | 169 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
| 170 std::wstring test_file2 = test_data_directory_; | 170 FilePath test_file2(FilePath::FromWStringHack(test_data_directory_)); |
| 171 file_util::AppendToPath(&test_file2, L"title1.html"); | 171 test_file2 = test_file2.AppendASCII("title1.html"); |
| 172 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); | 172 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); |
| 173 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, | 173 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, |
| 174 action_max_timeout_ms())); | 174 action_max_timeout_ms())); |
| 175 // Check accessibility object's children. | 175 // Check accessibility object's children. |
| 176 Sleep(sleep_timeout_ms()); | 176 Sleep(sleep_timeout_ms()); |
| 177 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | | 177 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | |
| 178 STATE_SYSTEM_FOCUSABLE | | 178 STATE_SYSTEM_FOCUSABLE | |
| 179 STATE_SYSTEM_UNAVAILABLE, | 179 STATE_SYSTEM_UNAVAILABLE, |
| 180 GetState(acc_obj)); | 180 GetState(acc_obj)); |
| 181 CHK_RELEASE(acc_obj); | 181 CHK_RELEASE(acc_obj); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 235 } |
| 236 | 236 |
| 237 // Now check Back status in different situations. | 237 // Now check Back status in different situations. |
| 238 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 238 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 239 ASSERT_TRUE(window.get()); | 239 ASSERT_TRUE(window.get()); |
| 240 int tab_count = -1; | 240 int tab_count = -1; |
| 241 | 241 |
| 242 // Set URL and check button status. | 242 // Set URL and check button status. |
| 243 scoped_ptr<TabProxy> tab1(window->GetTab(0)); | 243 scoped_ptr<TabProxy> tab1(window->GetTab(0)); |
| 244 ASSERT_TRUE(tab1.get()); | 244 ASSERT_TRUE(tab1.get()); |
| 245 std::wstring test_file1 = test_data_directory_; | 245 FilePath test_file1(FilePath::FromWStringHack(test_data_directory_)); |
| 246 file_util::AppendToPath(&test_file1, L"title1.html"); | 246 test_file1 = test_file1.AppendASCII("title1.html"); |
| 247 tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); | 247 tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); |
| 248 Sleep(sleep_timeout_ms()); | 248 Sleep(sleep_timeout_ms()); |
| 249 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | | 249 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | |
| 250 STATE_SYSTEM_FOCUSABLE | | 250 STATE_SYSTEM_FOCUSABLE | |
| 251 STATE_SYSTEM_UNAVAILABLE, | 251 STATE_SYSTEM_UNAVAILABLE, |
| 252 GetState(acc_obj)); | 252 GetState(acc_obj)); |
| 253 // Go Back and check status. | 253 // Go Back and check status. |
| 254 window->ApplyAccelerator(IDC_BACK); | 254 window->ApplyAccelerator(IDC_BACK); |
| 255 Sleep(sleep_timeout_ms()); | 255 Sleep(sleep_timeout_ms()); |
| 256 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE, | 256 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 268 ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB)); | 268 ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB)); |
| 269 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, | 269 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, |
| 270 action_max_timeout_ms())); | 270 action_max_timeout_ms())); |
| 271 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | | 271 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | |
| 272 STATE_SYSTEM_FOCUSABLE | | 272 STATE_SYSTEM_FOCUSABLE | |
| 273 STATE_SYSTEM_UNAVAILABLE, | 273 STATE_SYSTEM_UNAVAILABLE, |
| 274 GetState(acc_obj)); | 274 GetState(acc_obj)); |
| 275 | 275 |
| 276 // Add new tab with URL and check status. | 276 // Add new tab with URL and check status. |
| 277 ASSERT_TRUE(window->GetTabCount(&tab_count)); | 277 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
| 278 std::wstring test_file2 = test_data_directory_; | 278 FilePath test_file2(FilePath::FromWStringHack(test_data_directory_)); |
| 279 file_util::AppendToPath(&test_file2, L"title1.html"); | 279 test_file2 = test_file2.AppendASCII("title1.html"); |
| 280 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); | 280 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); |
| 281 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, | 281 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, |
| 282 action_max_timeout_ms())); | 282 action_max_timeout_ms())); |
| 283 Sleep(sleep_timeout_ms()); | 283 Sleep(sleep_timeout_ms()); |
| 284 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | | 284 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | |
| 285 STATE_SYSTEM_FOCUSABLE | | 285 STATE_SYSTEM_FOCUSABLE | |
| 286 STATE_SYSTEM_UNAVAILABLE, | 286 STATE_SYSTEM_UNAVAILABLE, |
| 287 GetState(acc_obj)); | 287 GetState(acc_obj)); |
| 288 CHK_RELEASE(acc_obj); | 288 CHK_RELEASE(acc_obj); |
| 289 } | 289 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 EXPECT_EQ(ROLE_SYSTEM_PUSHBUTTON, GetRole(acc_obj)); | 321 EXPECT_EQ(ROLE_SYSTEM_PUSHBUTTON, GetRole(acc_obj)); |
| 322 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); | 322 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); |
| 323 | 323 |
| 324 // Now, check Star status in different situations. | 324 // Now, check Star status in different situations. |
| 325 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 325 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 326 ASSERT_TRUE(window.get()); | 326 ASSERT_TRUE(window.get()); |
| 327 | 327 |
| 328 // Set URL and check button status. | 328 // Set URL and check button status. |
| 329 scoped_ptr<TabProxy> tab1(window->GetTab(0)); | 329 scoped_ptr<TabProxy> tab1(window->GetTab(0)); |
| 330 ASSERT_TRUE(tab1.get()); | 330 ASSERT_TRUE(tab1.get()); |
| 331 std::wstring test_file1 = test_data_directory_; | 331 FilePath test_file1(FilePath::FromWStringHack(test_data_directory_)); |
| 332 file_util::AppendToPath(&test_file1, L"title1.html"); | 332 test_file1 = test_file1.AppendASCII("title1.html"); |
| 333 tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); | 333 tab1->NavigateToURL(net::FilePathToFileURL(test_file1)); |
| 334 Sleep(sleep_timeout_ms()); | 334 Sleep(sleep_timeout_ms()); |
| 335 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); | 335 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); |
| 336 | 336 |
| 337 // Add empty new tab and check status. | 337 // Add empty new tab and check status. |
| 338 int tab_count = -1; | 338 int tab_count = -1; |
| 339 ASSERT_TRUE(window->GetTabCount(&tab_count)); | 339 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
| 340 ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB)); | 340 ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB)); |
| 341 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, | 341 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, |
| 342 action_max_timeout_ms())); | 342 action_max_timeout_ms())); |
| 343 // Check tab count. Also, check accessibility object's state. | 343 // Check tab count. Also, check accessibility object's state. |
| 344 Sleep(sleep_timeout_ms()); | 344 Sleep(sleep_timeout_ms()); |
| 345 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); | 345 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); |
| 346 | 346 |
| 347 // Add new tab with URL and check status. | 347 // Add new tab with URL and check status. |
| 348 ASSERT_TRUE(window->GetTabCount(&tab_count)); | 348 ASSERT_TRUE(window->GetTabCount(&tab_count)); |
| 349 std::wstring test_file2 = test_data_directory_; | 349 FilePath test_file2(FilePath::FromWStringHack(test_data_directory_)); |
| 350 file_util::AppendToPath(&test_file2, L"title1.html"); | 350 test_file2 = test_file2.AppendASCII("title1.html"); |
| 351 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); | 351 ASSERT_TRUE(window->AppendTab(net::FilePathToFileURL(test_file2))); |
| 352 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, | 352 ASSERT_TRUE(window->WaitForTabCountToBecome(tab_count + 1, |
| 353 action_max_timeout_ms())); | 353 action_max_timeout_ms())); |
| 354 // Check tab count. Also, check accessibility object's state. | 354 // Check tab count. Also, check accessibility object's state. |
| 355 Sleep(sleep_timeout_ms()); | 355 Sleep(sleep_timeout_ms()); |
| 356 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); | 356 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); |
| 357 | 357 |
| 358 CHK_RELEASE(acc_obj); | 358 CHK_RELEASE(acc_obj); |
| 359 } | 359 } |
| 360 | 360 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 // State "has popup" only supported in XP and higher. | 416 // State "has popup" only supported in XP and higher. |
| 417 if (win_util::GetWinVersion() > win_util::WINVERSION_2000) { | 417 if (win_util::GetWinVersion() > win_util::WINVERSION_2000) { |
| 418 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE, | 418 EXPECT_EQ(STATE_SYSTEM_HASPOPUP | STATE_SYSTEM_FOCUSABLE, |
| 419 GetState(acc_obj)); | 419 GetState(acc_obj)); |
| 420 } else { | 420 } else { |
| 421 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); | 421 EXPECT_EQ(STATE_SYSTEM_FOCUSABLE, GetState(acc_obj)); |
| 422 } | 422 } |
| 423 | 423 |
| 424 CHK_RELEASE(acc_obj); | 424 CHK_RELEASE(acc_obj); |
| 425 } | 425 } |
| OLD | NEW |