OLD | NEW |
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_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/gtk/view_id_util.h" | 11 #include "chrome/browser/ui/gtk/view_id_util.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
14 #include "net/test/test_server.h" | 15 #include "net/test/test_server.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 const char kSimplePage[] = "404_is_enough_for_us.html"; | 19 const char kSimplePage[] = "404_is_enough_for_us.html"; |
(...skipping 11 matching lines...) Expand all Loading... |
30 // the findbar is above the floating bookmark bar. | 31 // the findbar is above the floating bookmark bar. |
31 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) { | 32 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkInteractiveUITest, FindBarTest) { |
32 ASSERT_TRUE(test_server()->Start()); | 33 ASSERT_TRUE(test_server()->Start()); |
33 | 34 |
34 // Create new tab; open findbar. | 35 // Create new tab; open findbar. |
35 chrome::NewTab(browser()); | 36 chrome::NewTab(browser()); |
36 chrome::Find(browser()); | 37 chrome::Find(browser()); |
37 | 38 |
38 // Create new tab with an arbitrary URL. | 39 // Create new tab with an arbitrary URL. |
39 GURL url = test_server()->GetURL(kSimplePage); | 40 GURL url = test_server()->GetURL(kSimplePage); |
40 browser()->AddSelectedTabWithURL(url, content::PAGE_TRANSITION_TYPED); | 41 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); |
41 | 42 |
42 // Switch back to the NTP with the active findbar. | 43 // Switch back to the NTP with the active findbar. |
43 browser()->ActivateTabAt(1, false); | 44 chrome::ActivateTabAt(browser(), 1, false); |
44 | 45 |
45 // Wait for the findbar to show. | 46 // Wait for the findbar to show. |
46 MessageLoop::current()->RunAllPending(); | 47 MessageLoop::current()->RunAllPending(); |
47 | 48 |
48 // Set focus somewhere else, so that we can test clicking on the findbar | 49 // Set focus somewhere else, so that we can test clicking on the findbar |
49 // works. | 50 // works. |
50 chrome::FocusLocationBar(browser()); | 51 chrome::FocusLocationBar(browser()); |
51 ui_test_utils::ClickOnView(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); | 52 ui_test_utils::ClickOnView(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); |
52 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); | 53 ui_test_utils::IsViewFocused(browser(), VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); |
53 } | 54 } |
(...skipping 18 matching lines...) Expand all Loading... |
72 MessageLoop::current()->RunAllPending(); | 73 MessageLoop::current()->RunAllPending(); |
73 | 74 |
74 // This is kind of a hack. Calling this just once doesn't seem to send a click | 75 // This is kind of a hack. Calling this just once doesn't seem to send a click |
75 // event, but doing it twice works. | 76 // event, but doing it twice works. |
76 // http://crbug.com/35581 | 77 // http://crbug.com/35581 |
77 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); | 78 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); |
78 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); | 79 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); |
79 | 80 |
80 EXPECT_TRUE(has_been_clicked); | 81 EXPECT_TRUE(has_been_clicked); |
81 } | 82 } |
OLD | NEW |