Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: chrome/browser/ui/cocoa/status_bubble_mac_unittest.mm

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <Cocoa/Cocoa.h> 5 #include <Cocoa/Cocoa.h>
6 6
7 #include "base/memory/scoped_nsobject.h" 7 #include "base/memory/scoped_nsobject.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 // Test helper for moving the fake mouse location, and checking that 169 // Test helper for moving the fake mouse location, and checking that
170 // the bubble avoids that location. 170 // the bubble avoids that location.
171 // For convenience & clarity, coordinates are relative to the main window. 171 // For convenience & clarity, coordinates are relative to the main window.
172 bool CheckAvoidsMouse(int relative_x, int relative_y) { 172 bool CheckAvoidsMouse(int relative_x, int relative_y) {
173 SetMouseLocation(relative_x, relative_y); 173 SetMouseLocation(relative_x, relative_y);
174 return !IsPointInBubble(relative_x, relative_y); 174 return !IsPointInBubble(relative_x, relative_y);
175 } 175 }
176 176
177 MessageLoop message_loop_; 177 base::MessageLoop message_loop_;
178 scoped_nsobject<StatusBubbleMacTestDelegate> delegate_; 178 scoped_nsobject<StatusBubbleMacTestDelegate> delegate_;
179 StatusBubbleMac* bubble_; // Strong. 179 StatusBubbleMac* bubble_; // Strong.
180 }; 180 };
181 181
182 TEST_F(StatusBubbleMacTest, SetStatus) { 182 TEST_F(StatusBubbleMacTest, SetStatus) {
183 bubble_->SetStatus(string16()); 183 bubble_->SetStatus(string16());
184 bubble_->SetStatus(UTF8ToUTF16("This is a test")); 184 bubble_->SetStatus(UTF8ToUTF16("This is a test"));
185 EXPECT_NSEQ(@"This is a test", GetText()); 185 EXPECT_NSEQ(@"This is a test", GetText());
186 EXPECT_TRUE(IsVisible()); 186 EXPECT_TRUE(IsVisible());
187 187
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 int windowWidth = NSWidth([window frame]); 654 int windowWidth = NSWidth([window frame]);
655 for (int x = 0; x < windowWidth; x += smallValue) { 655 for (int x = 0; x < windowWidth; x += smallValue) {
656 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); 656 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue));
657 } 657 }
658 658
659 // Simulate moving the mouse from right to left. 659 // Simulate moving the mouse from right to left.
660 for (int x = windowWidth; x >= 0; x -= smallValue) { 660 for (int x = windowWidth; x >= 0; x -= smallValue) {
661 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue)); 661 ASSERT_TRUE(CheckAvoidsMouse(x, smallValue));
662 } 662 }
663 } 663 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/status_bubble_mac.mm ('k') | chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698