summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 01:44:00 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-03 01:44:00 +0000
commit80819047ee0ed2f24d3973d8ef78acee1f7a0dd9 (patch)
treef1ec62ae89c8614d1c24fa3f5024e9742380a8dc /chrome/browser/cocoa
parentfcb2cbc033d6115f2538ecb8ed12df05e7d33b01 (diff)
downloadchromium_src-80819047ee0ed2f24d3973d8ef78acee1f7a0dd9.zip
chromium_src-80819047ee0ed2f24d3973d8ef78acee1f7a0dd9.tar.gz
chromium_src-80819047ee0ed2f24d3973d8ef78acee1f7a0dd9.tar.bz2
Mac unit test: fix StatusBubbleMacTest.UpdateSizeAndPosition flakiness.
The success/failure of this test depends on the location of the mouse. Other StatusBubbleMacTest.* tests may have the same issue too. BUG=none TEST=trybots and less flakiness Review URL: http://codereview.chromium.org/460029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33649 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/status_bubble_mac_unittest.mm15
1 files changed, 14 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/status_bubble_mac_unittest.mm b/chrome/browser/cocoa/status_bubble_mac_unittest.mm
index 0a5f59a..7c72a9c 100644
--- a/chrome/browser/cocoa/status_bubble_mac_unittest.mm
+++ b/chrome/browser/cocoa/status_bubble_mac_unittest.mm
@@ -44,6 +44,19 @@
}
@end
+// This class implements, for testing purposes, a subclass of |StatusBubbleMac|
+// whose |MouseMoved()| method does nothing. (Ideally, we'd have a way of
+// controlling the "mouse" location, but the current implementation of
+// |StatusBubbleMac| uses |[NSEvent mouseLocation]| directly.) Without this,
+// tests can be flaky since results may depend on the mouse location.
+class StatusBubbleMacIgnoreMouseMoved : public StatusBubbleMac {
+ public:
+ StatusBubbleMacIgnoreMouseMoved(NSWindow* parent, id delegate)
+ : StatusBubbleMac(parent, delegate) {}
+
+ virtual void MouseMoved(const gfx::Point& location, bool left_content) {}
+};
+
class StatusBubbleMacTest : public CocoaTest {
public:
virtual void SetUp() {
@@ -52,7 +65,7 @@ class StatusBubbleMacTest : public CocoaTest {
EXPECT_TRUE(window);
delegate_.reset([[StatusBubbleMacTestDelegate alloc] init]);
EXPECT_TRUE(delegate_.get());
- bubble_ = new StatusBubbleMac(window, delegate_);
+ bubble_ = new StatusBubbleMacIgnoreMouseMoved(window, delegate_);
EXPECT_TRUE(bubble_);
// Turn off delays and transitions for test mode. This doesn't just speed