Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / bookmarks / bookmark_bar_gtk_interactive_uitest.cc
blobcca8aa32cdbd4c80f6703a3a1a24d15df892f197
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 <gtk/gtk.h>
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"
18 namespace {
20 const char kSimplePage[] = "/404_is_enough_for_us.html";
22 void OnClicked(GtkWidget* widget, bool* clicked_bit) {
23 *clicked_bit = true;
26 } // namespace
28 class BookmarkBarGtkInteractiveUITest : public InProcessBrowserTest {
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());
36 // Create new tab; open findbar.
37 chrome::NewTab(browser());
38 chrome::Find(browser());
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);
44 // Switch back to the NTP with the active findbar.
45 browser()->tab_strip_model()->ActivateTabAt(1, false);
47 // Wait for the findbar to show.
48 base::MessageLoop::current()->RunUntilIdle();
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);
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());
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);
70 // Create new tab.
71 chrome::NewTab(browser());
73 // Wait for the floating bar to appear.
74 base::MessageLoop::current()->RunUntilIdle();
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);
82 EXPECT_TRUE(has_been_clicked);