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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk_interactive_uitest.cc

Issue 16268017: GTTF: convert some tests in chrome to use EmbeddedTestServer patch nr 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 5 months 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
« no previous file with comments | « chrome/browser/ui/browser_focus_uitest.cc ('k') | chrome/browser/ui/pdf/pdf_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 6
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/browser_tabstrip.h" 9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/gtk/view_id_util.h" 11 #include "chrome/browser/ui/gtk/view_id_util.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/test/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/interactive_test_utils.h" 14 #include "chrome/test/base/interactive_test_utils.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "net/test/spawned_test_server/spawned_test_server.h" 16 #include "net/test/embedded_test_server/embedded_test_server.h"
17 17
18 namespace { 18 namespace {
19 19
20 const char kSimplePage[] = "404_is_enough_for_us.html"; 20 const char kSimplePage[] = "/404_is_enough_for_us.html";
21 21
22 void OnClicked(GtkWidget* widget, bool* clicked_bit) { 22 void OnClicked(GtkWidget* widget, bool* clicked_bit) {
23 *clicked_bit = true; 23 *clicked_bit = true;
24 } 24 }
25 25
26 } // namespace 26 } // namespace
27 27
28 class BookmarkBarGtkInteractiveUITest : public InProcessBrowserTest { 28 class BookmarkBarGtkInteractiveUITest : public InProcessBrowserTest {
29 }; 29 };
30 30
31 // Makes sure that when you switch back to an NTP with an active findbar, 31 // Makes sure that when you switch back to an NTP with an active findbar,
32 // the findbar is above the floating bookmark bar. 32 // the findbar is above the floating bookmark bar.
33 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) { 33 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) {
34 ASSERT_TRUE(test_server()->Start()); 34 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
35 35
36 // Create new tab; open findbar. 36 // Create new tab; open findbar.
37 chrome::NewTab(browser()); 37 chrome::NewTab(browser());
38 chrome::Find(browser()); 38 chrome::Find(browser());
39 39
40 // Create new tab with an arbitrary URL. 40 // Create new tab with an arbitrary URL.
41 GURL url = test_server()->GetURL(kSimplePage); 41 GURL url = embedded_test_server()->GetURL(kSimplePage);
42 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); 42 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED);
43 43
44 // Switch back to the NTP with the active findbar. 44 // Switch back to the NTP with the active findbar.
45 browser()->tab_strip_model()->ActivateTabAt(1, false); 45 browser()->tab_strip_model()->ActivateTabAt(1, false);
46 46
47 // Wait for the findbar to show. 47 // Wait for the findbar to show.
48 base::MessageLoop::current()->RunUntilIdle(); 48 base::MessageLoop::current()->RunUntilIdle();
49 49
50 // Set focus somewhere else, so that we can test clicking on the findbar 50 // Set focus somewhere else, so that we can test clicking on the findbar
51 // works. 51 // works.
52 chrome::FocusLocationBar(browser()); 52 chrome::FocusLocationBar(browser());
53 ui_test_utils::ClickOnView(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); 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); 54 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD);
55 } 55 }
56 56
57 // Makes sure that you can click on the floating bookmark bar. 57 // Makes sure that you can click on the floating bookmark bar.
58 // Disabled due to http://crbug.com/88933. 58 // Disabled due to http://crbug.com/88933.
59 IN_PROC_BROWSER_TEST_F( 59 IN_PROC_BROWSER_TEST_F(
60 BookmarkBarGtkInteractiveUITest, DISABLED_ClickOnFloatingTest) { 60 BookmarkBarGtkInteractiveUITest, DISABLED_ClickOnFloatingTest) {
61 ASSERT_TRUE(test_server()->Start()); 61 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
62 62
63 GtkWidget* other_bookmarks = 63 GtkWidget* other_bookmarks =
64 ViewIDUtil::GetWidget(GTK_WIDGET(browser()->window()->GetNativeWindow()), 64 ViewIDUtil::GetWidget(GTK_WIDGET(browser()->window()->GetNativeWindow()),
65 VIEW_ID_OTHER_BOOKMARKS); 65 VIEW_ID_OTHER_BOOKMARKS);
66 bool has_been_clicked = false; 66 bool has_been_clicked = false;
67 g_signal_connect(other_bookmarks, "clicked", 67 g_signal_connect(other_bookmarks, "clicked",
68 G_CALLBACK(OnClicked), &has_been_clicked); 68 G_CALLBACK(OnClicked), &has_been_clicked);
69 69
70 // Create new tab. 70 // Create new tab.
71 chrome::NewTab(browser()); 71 chrome::NewTab(browser());
72 72
73 // Wait for the floating bar to appear. 73 // Wait for the floating bar to appear.
74 base::MessageLoop::current()->RunUntilIdle(); 74 base::MessageLoop::current()->RunUntilIdle();
75 75
76 // This is kind of a hack. Calling this just once doesn't seem to send a click 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. 77 // event, but doing it twice works.
78 // http://crbug.com/35581 78 // http://crbug.com/35581
79 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); 79 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS);
80 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); 80 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS);
81 81
82 EXPECT_TRUE(has_been_clicked); 82 EXPECT_TRUE(has_been_clicked);
83 } 83 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_focus_uitest.cc ('k') | chrome/browser/ui/pdf/pdf_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698