Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / confirm_bubble_gtk_browsertest.cc
blob26a277a123d910e5e65e9244db6231597fc90370
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/gtk/confirm_bubble_gtk.h"
7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_window.h"
9 #include "chrome/browser/ui/test/test_confirm_bubble_model.h"
10 #include "chrome/test/base/in_process_browser_test.h"
12 class ConfirmBubbleGtkTest : public InProcessBrowserTest {
13 public:
14 ConfirmBubbleGtkTest()
15 : bubble_(NULL),
16 model_deleted_(false),
17 accept_clicked_(false),
18 cancel_clicked_(false),
19 link_clicked_(false) {
22 void ShowBubble() {
23 model_deleted_ = false;
24 accept_clicked_ = false;
25 cancel_clicked_ = false;
26 link_clicked_ = false;
28 gfx::Point point(0, 0);
29 bubble_ = new ConfirmBubbleGtk(
30 GTK_WIDGET(browser()->window()->GetNativeWindow()),
31 point,
32 new TestConfirmBubbleModel(&model_deleted_,
33 &accept_clicked_,
34 &cancel_clicked_,
35 &link_clicked_));
36 bubble_->Show();
39 ConfirmBubbleGtk* bubble() const { return bubble_; }
41 bool model_deleted() const {
42 return model_deleted_;
45 bool accept_clicked() const {
46 return accept_clicked_;
49 bool cancel_clicked() const {
50 return cancel_clicked_;
53 bool link_clicked() const {
54 return link_clicked_;
57 private:
58 ConfirmBubbleGtk* bubble_;
59 bool model_deleted_;
60 bool accept_clicked_;
61 bool cancel_clicked_;
62 bool link_clicked_;
65 // Verifies clicking a button or a link calls an appropriate model method and
66 // deletes the model.
67 IN_PROC_BROWSER_TEST_F(ConfirmBubbleGtkTest, ClickCancel) {
68 ShowBubble();
69 bubble()->OnCancelButton(NULL);
71 EXPECT_TRUE(model_deleted());
72 EXPECT_FALSE(accept_clicked());
73 EXPECT_TRUE(cancel_clicked());
74 EXPECT_FALSE(link_clicked());
77 IN_PROC_BROWSER_TEST_F(ConfirmBubbleGtkTest, ClickLink) {
78 ShowBubble();
79 bubble()->OnLinkButton(NULL);
81 EXPECT_TRUE(model_deleted());
82 EXPECT_FALSE(accept_clicked());
83 EXPECT_FALSE(cancel_clicked());
84 EXPECT_TRUE(link_clicked());
87 IN_PROC_BROWSER_TEST_F(ConfirmBubbleGtkTest, ClickOk) {
88 ShowBubble();
89 bubble()->OnOkButton(NULL);
91 EXPECT_TRUE(model_deleted());
92 EXPECT_TRUE(accept_clicked());
93 EXPECT_FALSE(cancel_clicked());
94 EXPECT_FALSE(link_clicked());