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

Side by Side Diff: chrome/test/ui_test_utils.h

Issue 6246001: Move app/key* to ui/base/keycodes/* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
« no previous file with comments | « chrome/test/render_view_test.cc ('k') | chrome/test/ui_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_TEST_UI_TEST_UTILS_H_ 5 #ifndef CHROME_TEST_UI_TEST_UTILS_H_
6 #define CHROME_TEST_UI_TEST_UTILS_H_ 6 #define CHROME_TEST_UI_TEST_UTILS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
11 #include <string> 11 #include <string>
12 #include <set> 12 #include <set>
13 13
14 #include "app/keyboard_codes.h"
15 #include "base/basictypes.h" 14 #include "base/basictypes.h"
16 #include "base/message_loop.h" 15 #include "base/message_loop.h"
17 #include "base/scoped_temp_dir.h" 16 #include "base/scoped_temp_dir.h"
18 #include "base/string16.h" 17 #include "base/string16.h"
19 #include "chrome/browser/ui/view_ids.h" 18 #include "chrome/browser/ui/view_ids.h"
20 #include "chrome/common/notification_observer.h" 19 #include "chrome/common/notification_observer.h"
21 #include "chrome/common/notification_registrar.h" 20 #include "chrome/common/notification_registrar.h"
22 #include "chrome/common/notification_service.h" 21 #include "chrome/common/notification_service.h"
23 #include "chrome/common/notification_source.h" 22 #include "chrome/common/notification_source.h"
24 #include "chrome/test/automation/dom_element_proxy.h" 23 #include "chrome/test/automation/dom_element_proxy.h"
25 #include "gfx/native_widget_types.h" 24 #include "gfx/native_widget_types.h"
26 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 #include "ui/base/keycodes/keyboard_codes.h"
27 #include "webkit/glue/window_open_disposition.h" 27 #include "webkit/glue/window_open_disposition.h"
28 28
29 class AppModalDialog; 29 class AppModalDialog;
30 class BookmarkModel; 30 class BookmarkModel;
31 class BookmarkNode; 31 class BookmarkNode;
32 class Browser; 32 class Browser;
33 class CommandLine; 33 class CommandLine;
34 class DownloadManager; 34 class DownloadManager;
35 class ExtensionAction; 35 class ExtensionAction;
36 class FilePath; 36 class FilePath;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // success. 250 // success.
251 bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT; 251 bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT;
252 252
253 // Gets the first browser that is not in the specified set. 253 // Gets the first browser that is not in the specified set.
254 Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers); 254 Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers);
255 255
256 // Sends a key press, blocking until the key press is received or the test times 256 // Sends a key press, blocking until the key press is received or the test times
257 // out. This uses ui_controls::SendKeyPress, see it for details. Returns true 257 // out. This uses ui_controls::SendKeyPress, see it for details. Returns true
258 // if the event was successfully sent and received. 258 // if the event was successfully sent and received.
259 bool SendKeyPressSync(const Browser* browser, 259 bool SendKeyPressSync(const Browser* browser,
260 app::KeyboardCode key, 260 ui::KeyboardCode key,
261 bool control, 261 bool control,
262 bool shift, 262 bool shift,
263 bool alt, 263 bool alt,
264 bool command) WARN_UNUSED_RESULT; 264 bool command) WARN_UNUSED_RESULT;
265 265
266 // Sends a key press, blocking until both the key press and a notification from 266 // Sends a key press, blocking until both the key press and a notification from
267 // |source| of type |type| are received, or until the test times out. This uses 267 // |source| of type |type| are received, or until the test times out. This uses
268 // ui_controls::SendKeyPress, see it for details. Returns true if the event was 268 // ui_controls::SendKeyPress, see it for details. Returns true if the event was
269 // successfully sent and both the event and notification were received. 269 // successfully sent and both the event and notification were received.
270 bool SendKeyPressAndWait(const Browser* browser, 270 bool SendKeyPressAndWait(const Browser* browser,
271 app::KeyboardCode key, 271 ui::KeyboardCode key,
272 bool control, 272 bool control,
273 bool shift, 273 bool shift,
274 bool alt, 274 bool alt,
275 bool command, 275 bool command,
276 NotificationType type, 276 NotificationType type,
277 const NotificationSource& source) WARN_UNUSED_RESULT; 277 const NotificationSource& source) WARN_UNUSED_RESULT;
278 278
279 // Run a message loop only for the specified amount of time. 279 // Run a message loop only for the specified amount of time.
280 class TimedMessageLoopRunner { 280 class TimedMessageLoopRunner {
281 public: 281 public:
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 std::map<uintptr_t, U> details_; 467 std::map<uintptr_t, U> details_;
468 468
469 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserverWithDetails); 469 DISALLOW_COPY_AND_ASSIGN(WindowedNotificationObserverWithDetails);
470 }; 470 };
471 471
472 // See SendKeyPressAndWait. This function additionally performs a check on the 472 // See SendKeyPressAndWait. This function additionally performs a check on the
473 // NotificationDetails using the provided Details<U>. 473 // NotificationDetails using the provided Details<U>.
474 template <class U> 474 template <class U>
475 bool SendKeyPressAndWaitWithDetails( 475 bool SendKeyPressAndWaitWithDetails(
476 const Browser* browser, 476 const Browser* browser,
477 app::KeyboardCode key, 477 ui::KeyboardCode key,
478 bool control, 478 bool control,
479 bool shift, 479 bool shift,
480 bool alt, 480 bool alt,
481 bool command, 481 bool command,
482 NotificationType type, 482 NotificationType type,
483 const NotificationSource& source, 483 const NotificationSource& source,
484 const Details<U>& details) WARN_UNUSED_RESULT; 484 const Details<U>& details) WARN_UNUSED_RESULT;
485 485
486 template <class U> 486 template <class U>
487 bool SendKeyPressAndWaitWithDetails( 487 bool SendKeyPressAndWaitWithDetails(
488 const Browser* browser, 488 const Browser* browser,
489 app::KeyboardCode key, 489 ui::KeyboardCode key,
490 bool control, 490 bool control,
491 bool shift, 491 bool shift,
492 bool alt, 492 bool alt,
493 bool command, 493 bool command,
494 NotificationType type, 494 NotificationType type,
495 const NotificationSource& source, 495 const NotificationSource& source,
496 const Details<U>& details) { 496 const Details<U>& details) {
497 WindowedNotificationObserverWithDetails<U> observer(type, source); 497 WindowedNotificationObserverWithDetails<U> observer(type, source);
498 498
499 if (!SendKeyPressSync(browser, key, control, shift, alt, command)) 499 if (!SendKeyPressSync(browser, key, control, shift, alt, command))
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 548
549 // Takes a snapshot of the entire page, according to the width and height 549 // Takes a snapshot of the entire page, according to the width and height
550 // properties of the DOM's document. Returns true on success. DOMAutomation 550 // properties of the DOM's document. Returns true on success. DOMAutomation
551 // must be enabled. 551 // must be enabled.
552 bool TakeEntirePageSnapshot(RenderViewHost* rvh, 552 bool TakeEntirePageSnapshot(RenderViewHost* rvh,
553 SkBitmap* bitmap) WARN_UNUSED_RESULT; 553 SkBitmap* bitmap) WARN_UNUSED_RESULT;
554 554
555 } // namespace ui_test_utils 555 } // namespace ui_test_utils
556 556
557 #endif // CHROME_TEST_UI_TEST_UTILS_H_ 557 #endif // CHROME_TEST_UI_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/test/render_view_test.cc ('k') | chrome/test/ui_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698