OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include <gtk/gtk.h> | |
6 | |
7 #include "chrome/browser/ui/browser.h" | |
8 #include "chrome/browser/ui/browser_commands.h" | |
9 #include "chrome/browser/ui/browser_tabstrip.h" | |
10 #include "chrome/browser/ui/browser_window.h" | |
11 #include "chrome/browser/ui/gtk/view_id_util.h" | |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
13 #include "chrome/test/base/in_process_browser_test.h" | |
14 #include "chrome/test/base/interactive_test_utils.h" | |
15 #include "chrome/test/base/ui_test_utils.h" | |
16 #include "net/test/embedded_test_server/embedded_test_server.h" | |
17 | |
18 namespace { | |
19 | |
20 const char kSimplePage[] = "/404_is_enough_for_us.html"; | |
21 | |
22 void OnClicked(GtkWidget* widget, bool* clicked_bit) { | |
23 *clicked_bit = true; | |
24 } | |
25 | |
26 } // namespace | |
27 | |
28 class BookmarkBarGtkInteractiveUITest : public InProcessBrowserTest { | |
29 }; | |
30 | |
31 // Makes sure that when you switch back to an NTP with an active findbar, | |
32 // the findbar is above the floating bookmark bar. | |
33 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) { | |
34 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
35 | |
36 // Create new tab; open findbar. | |
37 chrome::NewTab(browser()); | |
38 chrome::Find(browser()); | |
39 | |
40 // Create new tab with an arbitrary URL. | |
41 GURL url = embedded_test_server()->GetURL(kSimplePage); | |
42 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); | |
43 | |
44 // Switch back to the NTP with the active findbar. | |
45 browser()->tab_strip_model()->ActivateTabAt(1, false); | |
46 | |
47 // Wait for the findbar to show. | |
48 base::MessageLoop::current()->RunUntilIdle(); | |
49 | |
50 // Set focus somewhere else, so that we can test clicking on the findbar | |
51 // works. | |
52 chrome::FocusLocationBar(browser()); | |
53 ui_test_utils::ClickOnView(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); | |
54 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); | |
55 } | |
56 | |
57 // Makes sure that you can click on the floating bookmark bar. | |
58 // Disabled due to http://crbug.com/88933. | |
59 IN_PROC_BROWSER_TEST_F( | |
60 BookmarkBarGtkInteractiveUITest, DISABLED_ClickOnFloatingTest) { | |
61 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
62 | |
63 GtkWidget* other_bookmarks = | |
64 ViewIDUtil::GetWidget(GTK_WIDGET(browser()->window()->GetNativeWindow()), | |
65 VIEW_ID_OTHER_BOOKMARKS); | |
66 bool has_been_clicked = false; | |
67 g_signal_connect(other_bookmarks, "clicked", | |
68 G_CALLBACK(OnClicked), &has_been_clicked); | |
69 | |
70 // Create new tab. | |
71 chrome::NewTab(browser()); | |
72 | |
73 // Wait for the floating bar to appear. | |
74 base::MessageLoop::current()->RunUntilIdle(); | |
75 | |
76 // This is kind of a hack. Calling this just once doesn't seem to send a click | |
77 // event, but doing it twice works. | |
78 // http://crbug.com/35581 | |
79 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); | |
80 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); | |
81 | |
82 EXPECT_TRUE(has_been_clicked); | |
83 } | |
OLD | NEW |