OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
7 #include "chrome/browser/net/url_request_mock_http_job.h" | 7 #include "chrome/browser/net/url_request_mock_http_job.h" |
8 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, | 435 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, |
436 &tab_view_bounds, true)); | 436 &tab_view_bounds, true)); |
437 // Simulate a click to force user_gesture to true; if we don't, the resulting | 437 // Simulate a click to force user_gesture to true; if we don't, the resulting |
438 // popup will be constrained, which isn't what we want to test. | 438 // popup will be constrained, which isn't what we want to test. |
439 ASSERT_TRUE(window->SimulateOSClick(tab_view_bounds.CenterPoint(), | 439 ASSERT_TRUE(window->SimulateOSClick(tab_view_bounds.CenterPoint(), |
440 views::Event::EF_LEFT_BUTTON_DOWN)); | 440 views::Event::EF_LEFT_BUTTON_DOWN)); |
441 ASSERT_TRUE(browser->WaitForTabCountToBecome(2)); | 441 ASSERT_TRUE(browser->WaitForTabCountToBecome(2)); |
442 | 442 |
443 scoped_refptr<TabProxy> popup_tab(browser->GetActiveTab()); | 443 scoped_refptr<TabProxy> popup_tab(browser->GetActiveTab()); |
444 ASSERT_TRUE(popup_tab.get()); | 444 ASSERT_TRUE(popup_tab.get()); |
445 std::wstring popup_title; | 445 string16 popup_title; |
446 EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title)); | 446 EXPECT_TRUE(popup_tab->GetTabTitle(&popup_title)); |
447 EXPECT_EQ(std::wstring(L"popup"), popup_title); | 447 EXPECT_EQ(ASCIIToUTF16("popup"), popup_title); |
448 EXPECT_TRUE(popup_tab->Close(true)); | 448 EXPECT_TRUE(popup_tab->Close(true)); |
449 | 449 |
450 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); | 450 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); |
451 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); | 451 scoped_refptr<TabProxy> main_tab(browser->GetActiveTab()); |
452 ASSERT_TRUE(main_tab.get()); | 452 ASSERT_TRUE(main_tab.get()); |
453 std::wstring main_title; | 453 string16 main_title; |
454 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); | 454 EXPECT_TRUE(main_tab->GetTabTitle(&main_title)); |
455 EXPECT_EQ(std::wstring(L"only_one_unload"), main_title); | 455 EXPECT_EQ(ASCIIToUTF16("only_one_unload"), main_title); |
456 } | 456 } |
457 | 457 |
458 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 458 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
459 // and multiple windows. | 459 // and multiple windows. |
OLD | NEW |