| 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/file_path.h" |
| 7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 8 #include "chrome/browser/view_ids.h" | 9 #include "chrome/browser/view_ids.h" |
| 9 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
| 10 #include "chrome/common/l10n_util.h" | 11 #include "chrome/common/l10n_util.h" |
| 11 #include "chrome/test/automation/automation_constants.h" | 12 #include "chrome/test/automation/automation_constants.h" |
| 12 #include "chrome/test/automation/browser_proxy.h" | 13 #include "chrome/test/automation/browser_proxy.h" |
| 13 #include "chrome/test/automation/constrained_window_proxy.h" | 14 #include "chrome/test/automation/constrained_window_proxy.h" |
| 14 #include "chrome/test/automation/tab_proxy.h" | 15 #include "chrome/test/automation/tab_proxy.h" |
| 15 #include "chrome/test/automation/window_proxy.h" | 16 #include "chrome/test/automation/window_proxy.h" |
| 16 #include "chrome/test/ui/ui_test.h" | 17 #include "chrome/test/ui/ui_test.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 31 ASSERT_TRUE(browser_.get()); | 32 ASSERT_TRUE(browser_.get()); |
| 32 | 33 |
| 33 window_.reset(browser_->GetWindow()); | 34 window_.reset(browser_->GetWindow()); |
| 34 ASSERT_TRUE(window_.get()); | 35 ASSERT_TRUE(window_.get()); |
| 35 | 36 |
| 36 tab_.reset(browser_->GetTab(0)); | 37 tab_.reset(browser_->GetTab(0)); |
| 37 ASSERT_TRUE(tab_.get()); | 38 ASSERT_TRUE(tab_.get()); |
| 38 } | 39 } |
| 39 | 40 |
| 40 void NavigateMainTabTo(const std::wstring& file_name) { | 41 void NavigateMainTabTo(const std::wstring& file_name) { |
| 41 std::wstring filename(test_data_directory_); | 42 FilePath filename(FilePath::FromWStringHack(test_data_directory_)); |
| 42 file_util::AppendToPath(&filename, L"constrained_files"); | 43 filename = filename.AppendASCII("constrained_files"); |
| 43 file_util::AppendToPath(&filename, file_name); | 44 filename = filename.Append(FilePath::FromWStringHack(file_name)); |
| 44 ASSERT_TRUE(tab_->NavigateToURL(net::FilePathToFileURL(filename))); | 45 ASSERT_TRUE(tab_->NavigateToURL(net::FilePathToFileURL(filename))); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void SimulateClickInCenterOf(const scoped_ptr<WindowProxy>& window) { | 48 void SimulateClickInCenterOf(const scoped_ptr<WindowProxy>& window) { |
| 48 gfx::Rect tab_view_bounds; | 49 gfx::Rect tab_view_bounds; |
| 49 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, | 50 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_CONTAINER, |
| 50 &tab_view_bounds, true)); | 51 &tab_view_bounds, true)); |
| 51 | 52 |
| 52 // Simulate a click of the actual link to force user_gesture to be | 53 // Simulate a click of the actual link to force user_gesture to be |
| 53 // true; if we don't, the resulting popup will be constrained, which | 54 // true; if we don't, the resulting popup will be constrained, which |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 TEST_F(InteractiveConstrainedWindowTest, DontBreakOnBlur) { | 249 TEST_F(InteractiveConstrainedWindowTest, DontBreakOnBlur) { |
| 249 NavigateMainTabTo(L"window_blur_test.html"); | 250 NavigateMainTabTo(L"window_blur_test.html"); |
| 250 SimulateClickInCenterOf(window_); | 251 SimulateClickInCenterOf(window_); |
| 251 | 252 |
| 252 // Wait for the popup window to open. | 253 // Wait for the popup window to open. |
| 253 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000)); | 254 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000)); |
| 254 | 255 |
| 255 // We popup shouldn't be closed by the onblur handler. | 256 // We popup shouldn't be closed by the onblur handler. |
| 256 ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 1500)); | 257 ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 1500)); |
| 257 } | 258 } |
| OLD | NEW |