diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 20:06:46 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 20:06:46 +0000 |
commit | 06be80eed52cb90928dcd2e37cb0112518ed35d0 (patch) | |
tree | 8fac2efe8b25564e4076de4353f90b14d3ba854d | |
parent | 53c5804ed27befcf9305e0963bf5318221209ca3 (diff) | |
download | chromium_src-06be80eed52cb90928dcd2e37cb0112518ed35d0.zip chromium_src-06be80eed52cb90928dcd2e37cb0112518ed35d0.tar.gz chromium_src-06be80eed52cb90928dcd2e37cb0112518ed35d0.tar.bz2 |
Add a simple in-process bookmark manager test.
Review URL: http://codereview.chromium.org/174494
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24505 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_browsertest.cc | 34 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.cc | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.h | 6 | ||||
-rw-r--r-- | chrome/chrome.gyp | 7 |
4 files changed, 47 insertions, 5 deletions
diff --git a/chrome/browser/gtk/bookmark_manager_browsertest.cc b/chrome/browser/gtk/bookmark_manager_browsertest.cc new file mode 100644 index 0000000..0f09315 --- /dev/null +++ b/chrome/browser/gtk/bookmark_manager_browsertest.cc @@ -0,0 +1,34 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/keyboard_codes.h" +#include "chrome/browser/automation/ui_controls.h" +#include "chrome/browser/bookmarks/bookmark_model.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/gtk/bookmark_manager_gtk.h" +#include "chrome/test/in_process_browser_test.h" +#include "chrome/test/ui_test_utils.h" + +class BookmarkManagerTest : public InProcessBrowserTest { +}; + +// There was once a regression where we crashed when launching the bookmark +// manager, and another regression where we crashed when calling +// RecursiveFind(). This test aims to check for these simple crashes. +IN_PROC_BROWSER_TEST_F(BookmarkManagerTest, Crash) { + BookmarkManagerGtk::Show(browser()->profile()); + BookmarkManagerGtk* manager = BookmarkManagerGtk::GetCurrentManager(); + ASSERT_TRUE(manager); + + // Make sure RecursiveFind() is run. + manager->SelectInTree(manager->model_->GetBookmarkBarNode(), true); + + // Close the window. + ui_controls::SendKeyPressNotifyWhenDone(GTK_WINDOW(manager->window_), + base::VKEY_W, + true, false, false, + new MessageLoop::QuitTask()); + ui_test_utils::RunMessageLoop(); + ASSERT_FALSE(BookmarkManagerGtk::GetCurrentManager()); +} diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc index 5d9cf43..8c33312 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.cc +++ b/chrome/browser/gtk/bookmark_manager_gtk.cc @@ -552,6 +552,11 @@ GtkWidget* BookmarkManagerGtk::MakeRightPane() { return scrolled; } +// static +BookmarkManagerGtk* BookmarkManagerGtk::GetCurrentManager() { + return manager; +} + void BookmarkManagerGtk::SetInitialWindowSize() { // If we previously saved the window's bounds, use them. if (g_browser_process->local_state()) { diff --git a/chrome/browser/gtk/bookmark_manager_gtk.h b/chrome/browser/gtk/bookmark_manager_gtk.h index d61613e..bf68d1e 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.h +++ b/chrome/browser/gtk/bookmark_manager_gtk.h @@ -16,6 +16,7 @@ #include "chrome/browser/gtk/bookmark_context_menu.h" #include "chrome/browser/shell_dialogs.h" #include "chrome/common/gtk_tree.h" +#include "testing/gtest/include/gtest/gtest_prod.h" class BookmarkModel; class BookmarkTableModel; @@ -68,12 +69,17 @@ class BookmarkManagerGtk : public BookmarkModelObserver, int index, void* params); private: + FRIEND_TEST(BookmarkManagerTest, Crash); + explicit BookmarkManagerGtk(Profile* profile); void InitWidgets(); GtkWidget* MakeLeftPane(); GtkWidget* MakeRightPane(); + // Get the currently showing bookmark manager. Only used in testing. + static BookmarkManagerGtk* GetCurrentManager(); + // Set |window_|'s initial size, using its previous size if that was saved. void SetInitialWindowSize(); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 8acb09e..a684bfb 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -38,6 +38,8 @@ 'browser/browser_init_browsertest.cc', 'browser/crash_recovery_browsertest.cc', 'browser/download/save_page_browsertest.cc', + 'browser/gtk/bookmark_manager_browsertest.cc', + 'browser/gtk/view_id_util_browsertest.cc', 'browser/ssl/ssl_browser_tests.cc', ], 'browser_tests_sources_win_specific': [ @@ -5256,11 +5258,6 @@ ], }], ['OS=="mac"', { - # The test fetches resources which means Mac need the app bundle to - # exist on disk so it can pull from it. - 'dependencies': [ - 'chrome', - ], 'sources': [ 'app/breakpad_mac_stubs.mm', 'app/keystone_glue.h', |