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

Side by Side Diff: chrome_frame/test/infobar_unittests.cc

Issue 8555001: base::Bind: Convert chrome_frame/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: TaskMarshaller fix. Created 9 years, 1 month 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 <atlbase.h> 5 #include <atlbase.h>
6 #include <atlapp.h> 6 #include <atlapp.h>
7 #include <atlcrack.h> 7 #include <atlcrack.h>
8 #include <atlmisc.h> 8 #include <atlmisc.h>
9 #include <atlwin.h> 9 #include <atlwin.h>
10 10
11 #include "base/bind.h"
12 #include "base/bind_helpers.h"
11 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
14 #include "chrome_frame/infobars/infobar_content.h" 16 #include "chrome_frame/infobars/infobar_content.h"
15 #include "chrome_frame/infobars/internal/displaced_window_manager.h" 17 #include "chrome_frame/infobars/internal/displaced_window_manager.h"
16 #include "chrome_frame/infobars/internal/host_window_manager.h" 18 #include "chrome_frame/infobars/internal/host_window_manager.h"
17 #include "chrome_frame/infobars/internal/infobar_window.h" 19 #include "chrome_frame/infobars/internal/infobar_window.h"
18 #include "chrome_frame/infobars/internal/subclassing_window_with_delegate.h" 20 #include "chrome_frame/infobars/internal/subclassing_window_with_delegate.h"
19 #include "chrome_frame/test/chrome_frame_test_utils.h" 21 #include "chrome_frame/test/chrome_frame_test_utils.h"
20 22
21 DISABLE_RUNNABLE_METHOD_REFCOUNT(InfobarContent::Frame);
22 DISABLE_RUNNABLE_METHOD_REFCOUNT(InfobarManager);
23
24 namespace { 23 namespace {
25 24
26 RECT kInitialParentWindowRect = {20, 20, 300, 300}; 25 RECT kInitialParentWindowRect = {20, 20, 300, 300};
27 RECT kInitialChildWindowRect = {20, 20, 280, 280}; 26 RECT kInitialChildWindowRect = {20, 20, 280, 280};
28 27
29 MATCHER_P(EqualRect, expected, "") { 28 MATCHER_P(EqualRect, expected, "") {
30 return ::EqualRect(expected, arg); 29 return ::EqualRect(expected, arg);
31 } 30 }
32 31
33 ACTION_P2(RespondToNcCalcSize, result, rect) { 32 ACTION_P2(RespondToNcCalcSize, result, rect) {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 ACTION_P(CheckSetFlag, flag) { 396 ACTION_P(CheckSetFlag, flag) {
398 ASSERT_FALSE(*flag); 397 ASSERT_FALSE(*flag);
399 *flag = true; 398 *flag = true;
400 } 399 }
401 400
402 ACTION_P(ResetFlag, flag) { 401 ACTION_P(ResetFlag, flag) {
403 *flag = false; 402 *flag = false;
404 } 403 }
405 404
406 ACTION_P2(AsynchronousCloseOnFrame, loop, frame) { 405 ACTION_P2(AsynchronousCloseOnFrame, loop, frame) {
407 loop->PostDelayedTask( 406 loop->PostTask(FROM_HERE, base::Bind(&InfobarContent::Frame::CloseInfobar,
408 FROM_HERE, 407 base::Unretained(*frame)));
409 NewRunnableMethod(*frame, &InfobarContent::Frame::CloseInfobar),
410 0);
411 } 408 }
412 409
413 ACTION_P2(AsynchronousHideOnManager, loop, manager) { 410 ACTION_P2(AsynchronousHideOnManager, loop, manager) {
414 loop->PostDelayedTask( 411 loop->PostTask(FROM_HERE, base::Bind(&InfobarManager::Hide,
415 FROM_HERE, 412 base::Unretained(manager), TOP_INFOBAR));
416 NewRunnableMethod(manager, &InfobarManager::Hide, TOP_INFOBAR),
417 0);
418 } 413 }
419 414
420 }; // namespace 415 }; // namespace
421 416
422 // The test ensures that the content is sized at least once in each of the 417 // The test ensures that the content is sized at least once in each of the
423 // following ranges while fully opening and closing: 418 // following ranges while fully opening and closing:
424 // 419 //
425 // [0, infobar_height / 2) 420 // [0, infobar_height / 2)
426 // [infobar_height / 2, infobar_height) 421 // [infobar_height / 2, infobar_height)
427 // [infobar_height, infobar_height] 422 // [infobar_height, infobar_height]
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 594
600 message_loop.RunFor(10); // seconds 595 message_loop.RunFor(10); // seconds
601 596
602 window.DestroyWindow(); 597 window.DestroyWindow();
603 598
604 ASSERT_FALSE(message_loop.WasTimedOut()); 599 ASSERT_FALSE(message_loop.WasTimedOut());
605 } 600 }
606 601
607 // TODO(erikwright): Write test for variations on return from default 602 // TODO(erikwright): Write test for variations on return from default
608 // OnNcCalcValidRects 603 // OnNcCalcValidRects
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698