diff options
-rw-r--r-- | chrome/browser/automation/automation_constrained_window_tracker.h | 31 | ||||
-rwxr-xr-x | chrome/browser/automation/automation_provider.cc | 62 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 16 | ||||
-rw-r--r-- | chrome/browser/blocked_popup_container_interactive_uitest.cc (renamed from chrome/browser/views/constrained_window_impl_interactive_uitest.cc) | 17 | ||||
-rw-r--r-- | chrome/browser/tab_contents/constrained_window.h | 21 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 14 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 52 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.h | 8 | ||||
-rw-r--r-- | chrome/chrome.gyp | 7 | ||||
-rw-r--r--[-rwxr-xr-x] | chrome/test/automation/automation_messages_internal.h | 24 | ||||
-rw-r--r-- | chrome/test/automation/automation_proxy_uitest.cc | 3 | ||||
-rw-r--r-- | chrome/test/automation/constrained_window_proxy.cc | 44 | ||||
-rw-r--r-- | chrome/test/automation/constrained_window_proxy.h | 34 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.cc | 28 | ||||
-rw-r--r-- | chrome/test/automation/tab_proxy.h | 7 |
15 files changed, 36 insertions, 332 deletions
diff --git a/chrome/browser/automation/automation_constrained_window_tracker.h b/chrome/browser/automation/automation_constrained_window_tracker.h deleted file mode 100644 index fe4261a..0000000 --- a/chrome/browser/automation/automation_constrained_window_tracker.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_CONSTRAINED_WINDOW_TRACKER_H__ -#define CHROME_BROWSER_AUTOMATION_AUTOMATION_CONSTRAINED_WINDOW_TRACKER_H__ - -#include "chrome/browser/automation/automation_resource_tracker.h" -#include "chrome/browser/tab_contents/constrained_window.h" - -class AutomationConstrainedWindowTracker - : public AutomationResourceTracker<ConstrainedWindow*> { -public: - AutomationConstrainedWindowTracker(IPC::Message::Sender* automation) - : AutomationResourceTracker(automation) {} - - virtual ~AutomationConstrainedWindowTracker() { - } - - virtual void AddObserver(ConstrainedWindow* resource) { - registrar_.Add(this, NotificationType::CWINDOW_CLOSED, - Source<ConstrainedWindow>(resource)); - } - - virtual void RemoveObserver(ConstrainedWindow* resource) { - registrar_.Remove(this, NotificationType::CWINDOW_CLOSED, - Source<ConstrainedWindow>(resource)); - } -}; - -#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_CONSTRAINED_WINDOW_TRACKER_H__ diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 859beaf..9445b92 100755 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -805,12 +805,6 @@ AutomationProvider::AutomationProvider(Profile* profile) window_tracker_.reset(new AutomationWindowTracker(this)); autocomplete_edit_tracker_.reset( new AutomationAutocompleteEditTracker(this)); -#if defined(OS_WIN) - // TODO(port): Enable as the trackers get ported. - cwindow_tracker_.reset(new AutomationConstrainedWindowTracker(this)); -#else - NOTIMPLEMENTED() << "hook up constrained window tracker"; -#endif new_tab_ui_load_observer_.reset(new NewTabUILoadObserver(this)); dom_operation_observer_.reset(new DomOperationNotificationObserver(this)); dom_inspector_observer_.reset(new DomInspectorNotificationObserver(this)); @@ -996,8 +990,6 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { ExecuteJavascript) IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindowCount, GetConstrainedWindowCount) - IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindow, GetConstrainedWindow) - IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedTitle, GetConstrainedTitle) IPC_MESSAGE_HANDLER(AutomationMsg_FindInPage, HandleFindInPageRequest) IPC_MESSAGE_HANDLER(AutomationMsg_GetFocusedViewID, GetFocusedViewID) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_InspectElement, @@ -1051,8 +1043,6 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { AutocompleteEditIsQueryInProgress) IPC_MESSAGE_HANDLER(AutomationMsg_AutocompleteEditGetMatches, AutocompleteEditGetMatches) - IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindowBounds, - GetConstrainedWindowBounds) IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPage, HandleOpenFindInPageRequest) IPC_MESSAGE_HANDLER(AutomationMsg_HandleMessageFromExternalHost, @@ -2002,58 +1992,6 @@ void AutomationProvider::GetConstrainedWindowCount(int handle, int* count) { } } -void AutomationProvider::GetConstrainedWindow(int handle, int index, - int* cwindow_handle) { - *cwindow_handle = 0; - if (tab_tracker_->ContainsHandle(handle) && index >= 0) { - NavigationController* nav_controller = - tab_tracker_->GetResource(handle); - TabContents* tab = nav_controller->tab_contents(); - if (tab && index < static_cast<int>(tab->child_windows_.size())) { -#if defined(OS_WIN) - ConstrainedWindow* window = tab->child_windows_[index]; - *cwindow_handle = cwindow_tracker_->Add(window); -#else - // TODO(port): Enable when cwindow_tracker is ported. - NOTIMPLEMENTED(); -#endif - } - } -} - -void AutomationProvider::GetConstrainedTitle(int handle, - int* title_string_size, - std::wstring* title) { - *title_string_size = -1; // -1 is the error code -#if defined(OS_WIN) - if (cwindow_tracker_->ContainsHandle(handle)) { - ConstrainedWindow* window = cwindow_tracker_->GetResource(handle); - *title = window->GetWindowTitle(); - *title_string_size = static_cast<int>(title->size()); - } -#else - // TODO(port): Enable when cwindow_tracker is ported. - NOTIMPLEMENTED(); -#endif -} - -void AutomationProvider::GetConstrainedWindowBounds(int handle, bool* exists, - gfx::Rect* rect) { - *rect = gfx::Rect(0, 0, 0, 0); -#if defined(OS_WIN) - if (cwindow_tracker_->ContainsHandle(handle)) { - ConstrainedWindow* window = cwindow_tracker_->GetResource(handle); - if (window) { - *exists = true; - *rect = window->GetCurrentBounds(); - } - } -#else - // TODO(port): Enable when cwindow_tracker is ported. - NOTIMPLEMENTED(); -#endif -} - void AutomationProvider::HandleFindInPageRequest( int handle, const std::wstring& find_request, int forward, int match_case, int* active_ordinal, int* matches_found) { diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 389543a..ccf580d 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -32,11 +32,6 @@ #include "views/event.h" #endif // defined(OS_WIN) -#if defined(OS_WIN) -// TODO(port): enable these. -#include "chrome/browser/automation/automation_constrained_window_tracker.h" -#endif - struct AutomationMsg_Find_Params; namespace IPC { @@ -239,13 +234,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, void ApplyAccelerator(int handle, int id); void GetConstrainedWindowCount(int handle, int* count); - void GetConstrainedWindow(int handle, int index, int* cwindow_handle); - - void GetConstrainedTitle(int handle, int* title, - std::wstring* title_string_size); - - void GetConstrainedWindowBounds(int handle, bool* exists, - gfx::Rect* rect); // This function has been deprecated, please use HandleFindRequest. void HandleFindInPageRequest(int handle, @@ -487,10 +475,6 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, scoped_ptr<AutomationBrowserTracker> browser_tracker_; scoped_ptr<AutomationTabTracker> tab_tracker_; scoped_ptr<AutomationWindowTracker> window_tracker_; -#if defined(OS_WIN) - // TODO(port): Enable as trackers get ported. - scoped_ptr<AutomationConstrainedWindowTracker> cwindow_tracker_; -#endif scoped_ptr<AutomationAutocompleteEditTracker> autocomplete_edit_tracker_; scoped_ptr<NavigationControllerRestoredObserver> restore_tracker_; LoginHandlerMap login_handler_map_; diff --git a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc b/chrome/browser/blocked_popup_container_interactive_uitest.cc index fcd7639..a6eb304 100644 --- a/chrome/browser/views/constrained_window_impl_interactive_uitest.cc +++ b/chrome/browser/blocked_popup_container_interactive_uitest.cc @@ -10,7 +10,6 @@ #include "chrome/common/chrome_constants.h" #include "chrome/test/automation/automation_constants.h" #include "chrome/test/automation/browser_proxy.h" -#include "chrome/test/automation/constrained_window_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" #include "chrome/test/ui/ui_test.h" @@ -18,9 +17,9 @@ #include "net/base/net_util.h" #include "views/event.h" -class InteractiveConstrainedWindowTest : public UITest { +class BlockedPopupContainerInteractiveTest : public UITest { protected: - InteractiveConstrainedWindowTest() { + BlockedPopupContainerInteractiveTest() { show_window_ = true; } @@ -62,7 +61,7 @@ class InteractiveConstrainedWindowTest : public UITest { scoped_refptr<TabProxy> tab_; }; -TEST_F(InteractiveConstrainedWindowTest, TestOpenAndResizeTo) { +TEST_F(BlockedPopupContainerInteractiveTest, TestOpenAndResizeTo) { NavigateMainTabTo(L"constrained_window_onload_resizeto.html"); SimulateClickInCenterOf(window_); @@ -121,7 +120,7 @@ bool ParseCountOutOfTitle(const std::wstring& title, int* output) { // Tests that in the window.open() equivalent of a fork bomb, we stop building // windows. -TEST_F(InteractiveConstrainedWindowTest, DontSpawnEndlessPopups) { +TEST_F(BlockedPopupContainerInteractiveTest, DontSpawnEndlessPopups) { NavigateMainTabTo(L"infinite_popups.html"); SimulateClickInCenterOf(window_); @@ -164,7 +163,7 @@ TEST_F(InteractiveConstrainedWindowTest, DontSpawnEndlessPopups) { // Make sure that we refuse to close windows when a constrained popup is // displayed. -TEST_F(InteractiveConstrainedWindowTest, WindowOpenWindowClosePopup) { +TEST_F(BlockedPopupContainerInteractiveTest, WindowOpenWindowClosePopup) { NavigateMainTabTo(L"openclose_main.html"); SimulateClickInCenterOf(window_); @@ -183,7 +182,7 @@ TEST_F(InteractiveConstrainedWindowTest, WindowOpenWindowClosePopup) { ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 3000)); } -TEST_F(InteractiveConstrainedWindowTest, BlockAlertFromBlockedPopup) { +TEST_F(BlockedPopupContainerInteractiveTest, BlockAlertFromBlockedPopup) { NavigateMainTabTo(L"block_alert.html"); // Wait for there to be an app modal dialog (and fail if it's shown). @@ -200,7 +199,7 @@ TEST_F(InteractiveConstrainedWindowTest, BlockAlertFromBlockedPopup) { ASSERT_EQ(1, popup_count); } -TEST_F(InteractiveConstrainedWindowTest, ShowAlertFromNormalPopup) { +TEST_F(BlockedPopupContainerInteractiveTest, ShowAlertFromNormalPopup) { NavigateMainTabTo(L"show_alert.html"); SimulateClickInCenterOf(window_); @@ -221,7 +220,7 @@ TEST_F(InteractiveConstrainedWindowTest, ShowAlertFromNormalPopup) { // Make sure that window focus works while creating a popup window so that we // don't -TEST_F(InteractiveConstrainedWindowTest, DontBreakOnBlur) { +TEST_F(BlockedPopupContainerInteractiveTest, DontBreakOnBlur) { NavigateMainTabTo(L"window_blur_test.html"); SimulateClickInCenterOf(window_); diff --git a/chrome/browser/tab_contents/constrained_window.h b/chrome/browser/tab_contents/constrained_window.h index d26087c..eb30363 100644 --- a/chrome/browser/tab_contents/constrained_window.h +++ b/chrome/browser/tab_contents/constrained_window.h @@ -42,27 +42,6 @@ class ConstrainedWindow { // Closes the Constrained Window. virtual void CloseConstrainedWindow() = 0; - - // Repositions the Constrained Window so that the lower right corner - // of the titlebar is at the passed in |anchor_point|. - virtual void RepositionConstrainedWindowTo( - const gfx::Point& anchor_point) = 0; - - // Tells the Constrained Window that the constraining TabContents was hidden, - // e.g. via a tab switch. - virtual void WasHidden() = 0; - - // Tells the Constrained Window that the constraining TabContents became - // visible, e.g. via a tab switch. - virtual void DidBecomeSelected() = 0; - - // Returns the title of the Constrained Window. - virtual std::wstring GetWindowTitle() const = 0; - - // Returns the current display rectangle (relative to its - // parent). This method is only called from the unit tests to check - // the location/size of a constrained window. - virtual const gfx::Rect& GetCurrentBounds() const = 0; }; #endif // #ifndef CHROME_TAB_CONTENTS_BROWSER_CONSTRAINED_WINDOW_H_ diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 9453f98..ebea024 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -591,13 +591,6 @@ void TabContents::WasHidden() { // OnWindowPosChanged() notices and calls HideContents() (which calls us). if (render_widget_host_view()) render_widget_host_view()->WasHidden(); - - // Loop through children and send WasHidden to them, too. - int count = static_cast<int>(child_windows_.size()); - for (int i = count - 1; i >= 0; --i) { - ConstrainedWindow* window = child_windows_.at(i); - window->WasHidden(); - } } NotificationService::current()->Notify( @@ -614,13 +607,6 @@ void TabContents::Activate() { void TabContents::ShowContents() { if (render_widget_host_view()) render_widget_host_view()->DidBecomeSelected(); - - // Loop through children and send DidBecomeSelected to them, too. - int count = static_cast<int>(child_windows_.size()); - for (int i = count - 1; i >= 0; --i) { - ConstrainedWindow* window = child_windows_.at(i); - window->DidBecomeSelected(); - } } void TabContents::HideContents() { diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index af40fc5..4ff891e 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -592,28 +592,6 @@ views::NonClientFrameView* ConstrainedWindowImpl::CreateFrameViewForWindow() { return new ConstrainedWindowFrameView(this); } -void ConstrainedWindowImpl::ActivateConstrainedWindow() { - // Other pop-ups are simply moved to the front of the z-order. - SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); - - // Store the focus of our parent focus manager so we can restore it when we - // close. - views::FocusManager* focus_manager = - views::FocusManager::GetFocusManager(GetNativeView()); - DCHECK(focus_manager); - focus_manager = focus_manager->GetParentFocusManager(); - if (focus_manager) { - // We could not have a parent focus manager if the ConstrainedWindow is - // displayed in a tab that is not currently selected. - // TODO(jcampan): we should store the ConstrainedWindow active events in - // that case and replay them when the TabContents becomes selected. - focus_manager->StoreFocusedView(); - - // Give our window the focus so we get keyboard messages. - ::SetFocus(GetNativeView()); - } -} - void ConstrainedWindowImpl::CloseConstrainedWindow() { // Broadcast to all observers of NOTIFY_CWINDOW_CLOSED. // One example of such an observer is AutomationCWindowTracker in the @@ -625,14 +603,6 @@ void ConstrainedWindowImpl::CloseConstrainedWindow() { Close(); } -void ConstrainedWindowImpl::WasHidden() { - DLOG(INFO) << "WasHidden"; -} - -void ConstrainedWindowImpl::DidBecomeSelected() { - DLOG(INFO) << "DidBecomeSelected"; -} - std::wstring ConstrainedWindowImpl::GetWindowTitle() const { std::wstring display_title; if (GetDelegate()) @@ -671,6 +641,28 @@ void ConstrainedWindowImpl::InitAsDialog(const gfx::Rect& initial_bounds) { ActivateConstrainedWindow(); } +void ConstrainedWindowImpl::ActivateConstrainedWindow() { + // Other pop-ups are simply moved to the front of the z-order. + SetWindowPos(HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + + // Store the focus of our parent focus manager so we can restore it when we + // close. + views::FocusManager* focus_manager = + views::FocusManager::GetFocusManager(GetNativeView()); + DCHECK(focus_manager); + focus_manager = focus_manager->GetParentFocusManager(); + if (focus_manager) { + // We could not have a parent focus manager if the ConstrainedWindow is + // displayed in a tab that is not currently selected. + // TODO(jcampan): we should store the ConstrainedWindow active events in + // that case and replay them when the TabContents becomes selected. + focus_manager->StoreFocusedView(); + + // Give our window the focus so we get keyboard messages. + ::SetFocus(GetNativeView()); + } +} + //////////////////////////////////////////////////////////////////////////////// // ConstrainedWindowImpl, views::WidgetWin overrides: diff --git a/chrome/browser/views/constrained_window_impl.h b/chrome/browser/views/constrained_window_impl.h index 0760a4d..2f3c32e 100644 --- a/chrome/browser/views/constrained_window_impl.h +++ b/chrome/browser/views/constrained_window_impl.h @@ -36,10 +36,6 @@ class ConstrainedWindowImpl : public ConstrainedWindow, // Overridden from ConstrainedWindow: virtual void CloseConstrainedWindow(); - virtual void ActivateConstrainedWindow(); - virtual void RepositionConstrainedWindowTo(const gfx::Point& anchor_point) {} - virtual void WasHidden(); - virtual void DidBecomeSelected(); virtual std::wstring GetWindowTitle() const; virtual const gfx::Rect& GetCurrentBounds() const; @@ -63,6 +59,10 @@ class ConstrainedWindowImpl : public ConstrainedWindow, // views::View client area. void InitAsDialog(const gfx::Rect& initial_bounds); + // Moves this window to the front of the Z-order and registers us with the + // focus manager. + void ActivateConstrainedWindow(); + // The TabContents that owns and constrains this ConstrainedWindow. TabContents* owner_; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 09c6c6d..aedb853 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -570,7 +570,6 @@ 'browser/autofill_manager.h', 'browser/automation/automation_autocomplete_edit_tracker.h', 'browser/automation/automation_browser_tracker.h', - 'browser/automation/automation_constrained_window_tracker.h', 'browser/automation/extension_automation_constants.h', 'browser/automation/extension_automation_constants.cc', 'browser/automation/automation_extension_function.h', @@ -2888,8 +2887,6 @@ 'test/automation/automation_proxy.h', 'test/automation/browser_proxy.cc', 'test/automation/browser_proxy.h', - 'test/automation/constrained_window_proxy.cc', - 'test/automation/constrained_window_proxy.h', 'test/automation/tab_proxy.cc', 'test/automation/tab_proxy.h', 'test/automation/window_proxy.cc', @@ -4258,8 +4255,6 @@ 'test/automation/automation_proxy.h', 'test/automation/browser_proxy.cc', 'test/automation/browser_proxy.h', - 'test/automation/constrained_window_proxy.cc', - 'test/automation/constrained_window_proxy.h', 'test/automation/tab_proxy.cc', 'test/automation/tab_proxy.h', 'test/automation/window_proxy.cc', @@ -4418,7 +4413,7 @@ 'browser/browser_focus_uitest.cc', 'browser/debugger/devtools_sanity_unittest.cc', 'browser/views/bookmark_bar_view_test.cc', - 'browser/views/constrained_window_impl_interactive_uitest.cc', + 'browser/blocked_popup_container_interactive_uitest.cc', 'browser/views/find_bar_win_interactive_uitest.cc', 'browser/views/tabs/tab_dragging_test.cc', 'test/interactive_ui/npapi_interactive_test.cc', diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h index 91961cf..4367a46 100755..100644 --- a/chrome/test/automation/automation_messages_internal.h +++ b/chrome/test/automation/automation_messages_internal.h @@ -244,22 +244,6 @@ IPC_BEGIN_MESSAGES(Automation) int /* tab_handle */, int /* constrained_window_count */) - // This message requests the handle of the constrained window with the given - // (zero-based) index in the given tab. First parameter specifies the given - // tab handle, second specifies the given child_index. On error, the returned - // handle value is 0. - IPC_SYNC_MESSAGE_ROUTED2_1(AutomationMsg_ConstrainedWindow, - int, /* window_handle */ - int, /* child_index */ - int) /* constrained_handle */ - - // This message requests the the title of the constrained window with the - // given handle. The return value contains the size of the title string and - // title string. On error, this value should be -1 and empty string. Note - // that the title can be empty in which case the size would be 0. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_ConstrainedTitle, int, - int, std::wstring) - // This message requests the bounds of the specified View element in // window coordinates. // Request: @@ -667,14 +651,6 @@ IPC_BEGIN_MESSAGES(Automation) // exist. IPC_SYNC_MESSAGE_ROUTED0_1(AutomationMsg_LastActiveBrowserWindow, int) - // This message requests the bounds of a constrained window (relative to its - // containing TabContents). On an internal error, the boolean in the result - // will be set to false. - IPC_SYNC_MESSAGE_ROUTED1_2(AutomationMsg_ConstrainedWindowBounds, - int /* tab_handle */, - bool /* the requested window exists */, - gfx::Rect /* constrained_window_count */) - // This message notifies the AutomationProvider to save the page with given // handle. The first parameter is the handle to the tab resource. The second // parameter is the main HTML file name. The third parameter is the directory diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 611eab5..eb6140a 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -17,7 +17,6 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/json_value_serializer.h" #include "chrome/test/automation/automation_proxy_uitest.h" -#include "chrome/test/automation/constrained_window_proxy.h" #include "chrome/test/automation/browser_proxy.h" #include "chrome/test/automation/tab_proxy.h" #include "chrome/test/automation/window_proxy.h" @@ -622,7 +621,7 @@ TEST_F(AutomationProxyTest3, FrameDocumentCanBeAccessed) { // TODO(port): Need to port constrained_window_proxy.* first. #if defined(OS_WIN) -TEST_F(AutomationProxyTest, ConstrainedWindowTest) { +TEST_F(AutomationProxyTest, BlockedPopupTest) { scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); ASSERT_TRUE(window.get()); diff --git a/chrome/test/automation/constrained_window_proxy.cc b/chrome/test/automation/constrained_window_proxy.cc deleted file mode 100644 index fd78c5b..0000000 --- a/chrome/test/automation/constrained_window_proxy.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "constrained_window_proxy.h" - -#include "chrome/test/automation/automation_messages.h" -#include "chrome/test/automation/automation_proxy.h" - -bool ConstrainedWindowProxy::GetTitle(std::wstring* title) const { - if (!is_valid()) - return false; - - if (!title) { - NOTREACHED(); - return false; - } - - int title_size_response = -1; - - sender_->Send(new AutomationMsg_ConstrainedTitle(0, handle_, - &title_size_response, - title)); - return title_size_response >= 0; -} - -bool ConstrainedWindowProxy::GetBoundsWithTimeout(gfx::Rect* bounds, - uint32 timeout_ms, - bool* is_timeout) { - if (!is_valid()) - return false; - - if (!bounds) { - NOTREACHED(); - return false; - } - - bool result = false; - - sender_->SendWithTimeout(new AutomationMsg_ConstrainedWindowBounds( - 0, handle_, &result, bounds), timeout_ms, NULL); - - return result; -} diff --git a/chrome/test/automation/constrained_window_proxy.h b/chrome/test/automation/constrained_window_proxy.h deleted file mode 100644 index cb0ff59..0000000 --- a/chrome/test/automation/constrained_window_proxy.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_TEST_AUTOMATION_CONSTRAINED_WINDOW_PROXY_H__ -#define CHROME_TEST_AUTOMATION_CONSTRAINED_WINDOW_PROXY_H__ - -#include <string> - -#include "chrome/test/automation/automation_handle_tracker.h" - -namespace gfx { -class Rect; -} - -class ConstrainedWindowProxy : public AutomationResourceProxy { -public: - ConstrainedWindowProxy(AutomationMessageSender* sender, - AutomationHandleTracker* tracker, - int handle) - : AutomationResourceProxy(tracker, sender, handle) {} - - virtual ~ConstrainedWindowProxy() {} - - bool GetTitle(std::wstring* title) const; - bool GetBoundsWithTimeout(gfx::Rect* bounds, - uint32 timeout_ms, - bool* is_timeout); - -private: - DISALLOW_EVIL_CONSTRUCTORS(ConstrainedWindowProxy); -}; - -#endif // CHROME_TEST_AUTOMATION_CONSTRAINED_WINDOW_PROXY_H__ diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index f81e23b..dea3a54 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -11,7 +11,6 @@ #include "chrome/test/automation/automation_constants.h" #include "chrome/test/automation/automation_messages.h" #include "chrome/test/automation/automation_proxy.h" -#include "chrome/test/automation/constrained_window_proxy.h" #include "googleurl/src/gurl.h" bool TabProxy::GetTabTitle(std::wstring* title) const { @@ -324,33 +323,6 @@ bool TabProxy::GetConstrainedWindowCount(int* count) const { 0, handle_, count)); } -scoped_refptr<ConstrainedWindowProxy> TabProxy::GetConstrainedWindow( - int window_index) const { - if (!is_valid()) - return NULL; - - int handle = 0; - if (!sender_->Send(new AutomationMsg_ConstrainedWindow(0, handle_, - window_index, - &handle))) - return NULL; - - if (handle == 0) - return NULL; - - ConstrainedWindowProxy* w = static_cast<ConstrainedWindowProxy*>( - tracker_->GetResource(handle)); - if (!w) { - w = new ConstrainedWindowProxy(sender_, tracker_, handle); - w->AddRef(); - } - - // Since there is no scoped_refptr::attach. - scoped_refptr<ConstrainedWindowProxy> result; - result.swap(&w); - return result; -} - bool TabProxy::WaitForChildWindowCountToChange(int count, int* new_count, int wait_timeout) { int intervals = std::min(wait_timeout/automation::kSleepTime, 1); diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 5366119..0f7bcc5 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -21,7 +21,6 @@ #include "chrome/test/automation/automation_constants.h" #include "chrome/test/automation/automation_handle_tracker.h" -class ConstrainedWindowProxy; class GURL; class Value; namespace IPC { @@ -55,12 +54,6 @@ class TabProxy : public AutomationResourceProxy { // Gets the number of constrained window for this tab. bool GetConstrainedWindowCount(int* count) const; - // Gets the proxy object for constrained window within this tab. Ownership - // for the returned object is transfered to the caller. Returns NULL on - // failure. - scoped_refptr<ConstrainedWindowProxy> GetConstrainedWindow( - int window_index) const; - // Executes a javascript in a frame's context whose xpath is provided as the // first parameter and extract the values from the resulting json string. // Examples: |