| 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" |
| 11 #include "chrome/test/ui_test_utils.h" | 11 #include "chrome/test/ui_test_utils.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 const wchar_t kDocRoot[] = L"chrome/test/data"; | 15 const wchar_t kDocRoot[] = L"chrome/test/data"; |
| 16 const wchar_t kSimplePage[] = L"404_is_enough_for_us.html"; | 16 const char kSimplePage[] = "404_is_enough_for_us.html"; |
| 17 | 17 |
| 18 void OnClicked(GtkWidget* widget, bool* clicked_bit) { | 18 void OnClicked(GtkWidget* widget, bool* clicked_bit) { |
| 19 *clicked_bit = true; | 19 *clicked_bit = true; |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 class BookmarkBarGtkBrowserTest : public InProcessBrowserTest { | 24 class BookmarkBarGtkBrowserTest : public InProcessBrowserTest { |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // Makes sure that when you switch back to an NTP with an active findbar, | 27 // Makes sure that when you switch back to an NTP with an active findbar, |
| 28 // the findbar is above the floating bookmark bar. | 28 // the findbar is above the floating bookmark bar. |
| 29 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkBrowserTest, FindBarTest) { | 29 IN_PROC_BROWSER_TEST_F(BookmarkBarGtkBrowserTest, FindBarTest) { |
| 30 scoped_refptr<HTTPTestServer> server = | 30 scoped_refptr<HTTPTestServer> server = |
| 31 HTTPTestServer::CreateServer(kDocRoot, NULL); | 31 HTTPTestServer::CreateServer(kDocRoot, NULL); |
| 32 ASSERT_TRUE(NULL != server.get()); | 32 ASSERT_TRUE(NULL != server.get()); |
| 33 | 33 |
| 34 // Create new tab; open findbar. | 34 // Create new tab; open findbar. |
| 35 browser()->NewTab(); | 35 browser()->NewTab(); |
| 36 browser()->Find(); | 36 browser()->Find(); |
| 37 | 37 |
| 38 // Create new tab with an arbitrary URL. | 38 // Create new tab with an arbitrary URL. |
| 39 GURL url = server->TestServerPageW(kSimplePage); | 39 GURL url = server->TestServerPage(kSimplePage); |
| 40 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1, | 40 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1, |
| 41 Browser::ADD_SELECTED, NULL, std::string()); | 41 Browser::ADD_SELECTED, NULL, std::string()); |
| 42 | 42 |
| 43 // Switch back to the NTP with the active findbar. | 43 // Switch back to the NTP with the active findbar. |
| 44 browser()->SelectTabContentsAt(1, false); | 44 browser()->SelectTabContentsAt(1, false); |
| 45 | 45 |
| 46 // Wait for the findbar to show. | 46 // Wait for the findbar to show. |
| 47 MessageLoop::current()->RunAllPending(); | 47 MessageLoop::current()->RunAllPending(); |
| 48 | 48 |
| 49 // 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 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 73 MessageLoop::current()->RunAllPending(); | 73 MessageLoop::current()->RunAllPending(); |
| 74 | 74 |
| 75 // 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 |
| 76 // event, but doing it twice works. | 76 // event, but doing it twice works. |
| 77 // http://crbug.com/35581 | 77 // http://crbug.com/35581 |
| 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 ui_test_utils::ClickOnView(browser(), VIEW_ID_OTHER_BOOKMARKS); |
| 80 | 80 |
| 81 EXPECT_TRUE(has_been_clicked); | 81 EXPECT_TRUE(has_been_clicked); |
| 82 } | 82 } |
| OLD | NEW |