| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/browser_window.h" | 8 #include "chrome/browser/browser_window.h" |
| 9 #include "chrome/browser/gtk/view_id_util.h" | 9 #include "chrome/browser/gtk/view_id_util.h" |
| 10 #include "chrome/test/in_process_browser_test.h" | 10 #include "chrome/test/in_process_browser_test.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkBrowserTest, FindBarTest) { | 30 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkBrowserTest, FindBarTest) { |
| 31 scoped_refptr<net::HTTPTestServer> server( | 31 scoped_refptr<net::HTTPTestServer> server( |
| 32 net::HTTPTestServer::CreateServer(kDocRoot)); | 32 net::HTTPTestServer::CreateServer(kDocRoot)); |
| 33 ASSERT_TRUE(NULL != server.get()); | 33 ASSERT_TRUE(NULL != server.get()); |
| 34 | 34 |
| 35 // Create new tab; open findbar. | 35 // Create new tab; open findbar. |
| 36 browser()->NewTab(); | 36 browser()->NewTab(); |
| 37 browser()->Find(); | 37 browser()->Find(); |
| 38 | 38 |
| 39 // Create new tab with an arbitrary URL. | 39 // Create new tab with an arbitrary URL. |
| 40 Browser* browser_used = NULL; |
| 40 GURL url = server->TestServerPage(kSimplePage); | 41 GURL url = server->TestServerPage(kSimplePage); |
| 41 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1, | 42 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1, |
| 42 TabStripModel::ADD_SELECTED, NULL, std::string()); | 43 TabStripModel::ADD_SELECTED, NULL, std::string(), |
| 44 &browser_used); |
| 45 EXPECT_EQ(browser(), browser_used); |
| 43 | 46 |
| 44 // Switch back to the NTP with the active findbar. | 47 // Switch back to the NTP with the active findbar. |
| 45 browser()->SelectTabContentsAt(1, false); | 48 browser()->SelectTabContentsAt(1, false); |
| 46 | 49 |
| 47 // Wait for the findbar to show. | 50 // Wait for the findbar to show. |
| 48 MessageLoop::current()->RunAllPending(); | 51 MessageLoop::current()->RunAllPending(); |
| 49 | 52 |
| 50 // Set focus somewhere else, so that we can test clicking on the findbar | 53 // Set focus somewhere else, so that we can test clicking on the findbar |
| 51 // works. | 54 // works. |
| 52 browser()->FocusLocationBar(); | 55 browser()->FocusLocationBar(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 74 MessageLoop::current()->RunAllPending(); | 77 MessageLoop::current()->RunAllPending(); |
| 75 | 78 |
| 76 // This is kind of a hack. Calling this just once doesn't seem to send a click | 79 // This is kind of a hack. Calling this just once doesn't seem to send a click |
| 77 // event, but doing it twice works. | 80 // event, but doing it twice works. |
| 78 // http://crbug.com/35581 | 81 // http://crbug.com/35581 |
| 79 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); | 82 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); |
| 80 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); | 83 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); |
| 81 | 84 |
| 82 EXPECT_TRUE(has_been_clicked); | 85 EXPECT_TRUE(has_been_clicked); |
| 83 } | 86 } |
| OLD | NEW |