summaryrefslogtreecommitdiffstats
path: root/ui/views/bubble/bubble_delegate_unittest.cc
blob: 6e61b5ef16d3558860688431e998859510c507ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/test/views_test_base.h"
#include "views/widget/widget.h"

namespace views {

typedef ViewsTestBase BubbleDelegateTest;

TEST_F(BubbleDelegateTest, CreateDelegate) {
  BubbleDelegateView* bubble_delegate = new BubbleDelegateView(
      NULL, BubbleBorder::NONE, SK_ColorGREEN);
  Widget* bubble_widget(
      BubbleDelegateView::CreateBubble(bubble_delegate));
  EXPECT_EQ(bubble_delegate, bubble_widget->widget_delegate());
  EXPECT_EQ(bubble_widget, bubble_delegate->GetWidget());

  BubbleBorder* border =
      bubble_delegate->GetBubbleFrameView()->bubble_border();
  EXPECT_EQ(bubble_delegate->GetArrowLocation(), border->arrow_location());
  EXPECT_EQ(bubble_delegate->GetColor(), border->background_color());

  bubble_widget->CloseNow();
  RunPendingMessages();
}

}  // namespace views