summaryrefslogtreecommitdiffstats
path: root/ui/views/test/widget_test.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove the 2-level input method system & InputMethodBridge.shuchen2015-07-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | This is IMF refactoring according to the design: - For @google.com: https://docs.google.com/document/d/14PQN4fbbSTlJmIk6qk7RzsuNr7O22DUTfNQ6slxKWV0 - For @chromium.org: https://docs.google.com/document/d/1sDES_kuEVUjb_FwCvKsg0Ef48edq5lAx589r0qUtG4g This cl includes some fundamental changes: 1) Removed ui/views/ime/... 2) All TextInputClient's use InputMethod::SetFocusedTextInputClient() to inform InputMethod that itself is focused. 3) Supports mocking input method in InputMethodFactory for TextfieldTest. 4) Removed views::View::GetTextInputClient() which is useless. The rest changes follow the above major changes. BUG=474828 TEST=Verified locally on Win7/Win8/Linux/CrOS/Mac. Tests passed. Review URL: https://codereview.chromium.org/1177503003 Cr-Commit-Position: refs/heads/master@{#337157}
* MacViews: Run focus_manager_unittests with views_unittests on Mactapted2015-06-241-1/+7
| | | | | | | | | | | | | | | | | | | One test (FocusManagerTest.WidgetFocusChangeListener) had an Aura dependency to do aura::client::GetFocusClient(..)->FocusWindow(..). For the (non-desktop) widgets in this test, this is an aura::test::TestFocusClient. This CL encapsulates the platform-specific activation behind Widget::SimulateNativeActivate(..) which uses the FocusClient on Aura and simulates messages from the OS for Mac. All the FocusManagerTest.* views_unittests pass on Mac. BUG=378134 Review URL: https://codereview.chromium.org/1195343002 Cr-Commit-Position: refs/heads/master@{#335862}
* Mac/Linux: Ensure window size constraints propagate to the window server ↵tapted2015-04-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | during Init Currently fixed-size views dialogs on Mac don't initialize properly. (And, e.g., WebDialogBrowserTest.SizeWindow fails because of it). Desktop Linux has a similar issue. On desktop Linux, NativeWidgetPrivate::OnRootViewLayout triggers a call to UpdateMinAndMaxSize. OnRootViewLayout happens during Widget::Init() but the X11 window is not yet mapped, so this was resulting in a no-op. For Linux, fix by explicitly calling UpdateMinAndMaxSize after the window is mapped. Mac needs to do a similar thing during Init. However, Mac was calling OnSizeConstraintsChanged() before Widget::Init() had set the non-client view, so Widget::GetMinimumSize() returned invalid sizes. For Mac, move the OnSizeConstraintsChanged() call to OnRootViewLayout(), similar to Linux. Then, add a cross-platform test. Mac was not clamping to the size constraints in SetBounds(), so do that. For the test itself, collapse the testing WidgetDelegates in widget_unittest.cc into one helper class rather than adding yet another WidgetDelegate. Then, provide a way to query the OS for the minimum window size to fill the gaps required for testing the propagation of size constraints to the window server. BUG=454698, 447086 Review URL: https://codereview.chromium.org/1059853007 Cr-Commit-Position: refs/heads/master@{#325538}
* MacViews: Implement NativeWidgetMac::GetWindowPlacement, add WidgetTesttapted2015-04-111-7/+10
| | | | | | | | | | | | | | | | | | | | | | GetWindowPlacement was previously NOTIMPLEMENTED(). It needed test coverage, so a cross-platform test is added. Add WidgetTest::CreateNativeDesktopWidget() for this which creates *desktop* widgets everywhere except ChromeOS. This makes the tests more interesting by using DesktopWindowTreeHosts on Windows and (eventually) Linux. Currently most WidgetTests just use NativeWidgetAuras or #ifdef !OS_CHROMEOS to test desktop widgets. This approach is neater and helps retain test coverage once DesktopWindowTreeHostMac appears. Adds WidgetTest.GetWindowPlacement which works as-advertised on MacViews. The test still runs everywhere, but has some special traps on every other platform. Document them. BUG=454698, 475813 Review URL: https://codereview.chromium.org/1072713002 Cr-Commit-Position: refs/heads/master@{#324742}
* MacViews: Fix widget activation.tapted2015-01-151-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes NativeWidetMac::IsActive(), and gets some WidgetTestInteractive activation tests passing, without regressing any views_unittests. NativeWidetMac::IsActive had a bit of a hack to try to make it synchronous. This once allowed tests designed for non-Desktop Aura widgets to work the same for *desktop* widgets on Mac, but it was never quite right. For Aura, these tests are using non-Desktop Aura widgets, which are parented off the root window and are able to ask the per-process aura window manager for the active window. This avoids having to run in an interactive_ui_test. However, the same is not true for desktop Aura widgets (e.g. activation on desktop Linux needs to communicate with the window server and has the same problems here as Mac if desktop widgets are used). On Mac, all widgets are desktop widgets for now. Calls to activate the window are mostly processed synchronously (e.g. visibility and layering). However, the system does not update the window reported by [NSApplication keyWindow] in the same runloop iteration. IsActive() on Mac is now just [NSWindow isKeyWindow], and Widget::CanActivate() is honored. To avoid making textfield views_unittests flaky, test::WidgetTest::FakeWidgetIsActiveAlways() is added. On Mac, this calls into the Objective-C runtime to force [NSWindow isKeyWindow] to return `YES`. To avoid making a subset of WidgetTests using GetWidgetShowState() flaky, these tests (and GetWidgetShowState()) are moved to WidgetTestInteractive, and a WidgetObserver used on Mac to ensure an activation is processed by the OS. Moving these previously non-interactive UI tests to interactive_ui_tests isn't ideal. However, it means a follow-up can enable these tests for desktop widgets on other (non-Mac) desktop platforms, which use different codepaths and are currently missing out on some coverage. Gets the following tests passing: WidgetTestInteractive.CanActivateFlagIsHonored WidgetTestInteractive.DisableViewDoesNotActivateWidget WidgetTestInteractive.ViewFocusOnWidgetActivationChanges BUG=402679 Review URL: https://codereview.chromium.org/840183002 Cr-Commit-Position: refs/heads/master@{#311597}
* MacViews: Fix child window z-order and SetBoundstapted2015-01-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The search box in the app list is a child views::Widget (so that it can animate over WebContents). Its position and z-order were broken on MacViews. The z-order issue boils down to a quirk in Cocoa where it is unable to correctly process a call to -[NSWindow orderWindow:relativeTo:] that is made in response to a visibility change in the same iteration over the event loop. To fix, make use of -[NSWindow addChildWindow:]. However, we must work around the issues it has. Specifically, it falls apart when we want to have hidden windows: Adding a child window always shows it, and hiding a child window detaches it. To fix that, child windows are removed from -[NSWindow childWindows] when ordered out and added back when the NSWindow becomes visible again. Then, to ensure visibility changes not initiated by BridgedNativeWidget::SetVisibilityState() correctly manage these children, calls to NotifyVisibilityChangeDown() are moved to a single call in OnVisibilityChangedTo(), called from the NSWindowDelegate after the visibility change is fed through to Cocoa. The x/y position bug was simpler. Mac was just missing the logic in aura::Window::SetBoundsInternal() that offsets the bounds when there is a parent. Cross-platform regression tests are added for these. The app_list_unittest AppListViewTestDesktopInstance/AppListViewTestDesktop.SearchResultsTest/2 also passes after this on MacViews. BUG=378134,365977 Review URL: https://codereview.chromium.org/831643004 Cr-Commit-Position: refs/heads/master@{#310647}
* Standardize usage of virtual/override/final specifiers.dcheng2014-10-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Google C++ style guide states: Explicitly annotate overrides of virtual functions or virtual destructors with an override or (less frequently) final specifier. Older (pre-C++11) code will use the virtual keyword as an inferior alternative annotation. For clarity, use exactly one of override, final, or virtual when declaring an override. To better conform to these guidelines, the following constructs have been rewritten: - if a base class has a virtual destructor, then: virtual ~Foo(); -> ~Foo() override; - virtual void Foo() override; -> void Foo() override; - virtual void Foo() override final; -> void Foo() final; This patch was automatically generated. The clang plugin can generate fixit hints, which are suggested edits when it is 100% sure it knows how to fix a problem. The hints from the clang plugin were applied to the source tree using the tool in https://codereview.chromium.org/598073004. BUG=417463 R=sky@chromium.org Review URL: https://codereview.chromium.org/679233002 Cr-Commit-Position: refs/heads/master@{#301449}
* replace OVERRIDE and FINAL with override and final in ui/mostynb2014-10-091-3/+3
| | | | | | | | BUG=417463 Review URL: https://codereview.chromium.org/623293004 Cr-Commit-Position: refs/heads/master@{#298839}
* MacViews: Encapsulate some Aura specifics in widget_unittest.cctapted@chromium.org2014-06-191-1/+34
| | | | | | | | | | | | | | | | | | | | | This adds a few helper functions to WidgetTest for getting information from a native widget and makes widget_test.h responsible for defining typedefs for PlatformNativeWidget and (when not ChromeOS) PlatformDesktopNativeWidget. 4 aura-specific tests (that are #ifdefd out on ChromeOS) that use DesktopAuraTopLevelWindowTest are moved from widget/widget_unittest.cc to widget/desktop_aura/desktop_native_widget_aura_unittest.cc widget_unittests.cc doesn't yet compile on Mac with this alone due to the event generator (addressed in CL/322893005). BUG=378134 TEST=views_unittests Review URL: https://codereview.chromium.org/334573008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278400 0039d316-1c4b-4281-b951-d872f2087c98
* Nukes USE_AURA ifdefs from viewssky@chromium.org2014-03-101-13/+1
| | | | | | | | | | | | No longer needed. BUG=none TEST=none R=ben@chromium.org Review URL: https://codereview.chromium.org/191723003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255976 0039d316-1c4b-4281-b951-d872f2087c98
* Purge unused code once associated with NativeWidgetWin.tapted@chromium.org2014-03-051-11/+0
| | | | | | | | | | | | | | src/ui/views/native_widget_win.h doesn't exist any more (since r247647). This removes some remaining code that was only used by NativeWidgetWin, and purges remaining references to NativeWidgetWin. Removes views::DropTargetWin and unused unit tests. BUG=330735 Review URL: https://codereview.chromium.org/185463009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255020 0039d316-1c4b-4281-b951-d872f2087c98
* rAc: Enforce a 3 second grace period for generated card bubble.estade@chromium.org2013-09-061-0/+98
Bubble may not be dismissed for the first 3 seconds (except by clicking on the Learn More link). The length of the grace period is subject to future tweaking. BUG=282671 Review URL: https://chromiumcodereview.appspot.com/23533030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221601 0039d316-1c4b-4281-b951-d872f2087c98