diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 02:57:55 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 02:57:55 +0000 |
commit | f83b6736a3d555987680243662698571d875875e (patch) | |
tree | 26ab8aa0e9c92f683bbc02190a900da4b3643eb0 | |
parent | 416634b04ddba855a8d41ee234a691b462270b25 (diff) | |
download | chromium_src-f83b6736a3d555987680243662698571d875875e.zip chromium_src-f83b6736a3d555987680243662698571d875875e.tar.gz chromium_src-f83b6736a3d555987680243662698571d875875e.tar.bz2 |
Implement a gtk test shell function. Pass dom_operations test shell test.
Review URL: http://codereview.chromium.org/8230
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4956 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/tools/test_shell/SConscript | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 16 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.h | 4 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 12 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_win.cc | 7 |
5 files changed, 25 insertions, 16 deletions
diff --git a/webkit/tools/test_shell/SConscript b/webkit/tools/test_shell/SConscript index d90de13..cbee0f7 100644 --- a/webkit/tools/test_shell/SConscript +++ b/webkit/tools/test_shell/SConscript @@ -163,6 +163,7 @@ test_files = [ '$WEBKIT_DIR/glue/bookmarklet_unittest.cc', '$WEBKIT_DIR/glue/cpp_bound_class_unittest.cc', '$WEBKIT_DIR/glue/cpp_variant_unittest.cc', + '$WEBKIT_DIR/glue/dom_operations_unittest.cc', '$WEBKIT_DIR/glue/glue_serialize_unittest.cc', '$WEBKIT_DIR/glue/iframe_redirect_unittest.cc', '$WEBKIT_DIR/glue/multipart_response_delegate_unittest.cc', @@ -179,7 +180,6 @@ if env['PLATFORM'] == 'win32': 'plugin_tests.cc', 'text_input_controller_unittest.cc', '$WEBKIT_DIR/glue/context_menu_unittest.cc', - '$WEBKIT_DIR/glue/dom_operations_unittest.cc', '$WEBKIT_DIR/glue/dom_serializer_unittest.cc', '$WEBKIT_DIR/glue/mimetype_unittest.cc', '$WEBKIT_DIR/glue/resource_fetcher_unittest.cc', diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 43e143f..02e7df5 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -225,7 +225,21 @@ void TestShell::ResetWebPreferences() { web_prefs_->allow_scripts_to_close_windows = false; } } - + +// static +bool TestShell::RemoveWindowFromList(gfx::WindowHandle window) { + WindowList::iterator entry = + std::find(TestShell::windowList()->begin(), + TestShell::windowList()->end(), + window); + if (entry != TestShell::windowList()->end()) { + TestShell::windowList()->erase(entry); + return true; + } + + return false; +} + void TestShell::Show(WebView* webview, WindowOpenDisposition disposition) { delegate_->Show(webview, disposition); } diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h index bfafd37..839d1ae 100644 --- a/webkit/tools/test_shell/test_shell.h +++ b/webkit/tools/test_shell/test_shell.h @@ -167,6 +167,10 @@ public: static void DestroyWindow(gfx::WindowHandle windowHandle); + // Remove the given window from window_list_, return true if it was in the + // list and was removed and false otherwise. + static bool RemoveWindowFromList(gfx::WindowHandle window); + // Implements CreateWebView for TestWebViewDelegate, which in turn // is called as a WebViewDelegate. WebView* CreateWebView(WebView* webview); diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index ee3c6ed..b637f98 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -53,14 +53,7 @@ namespace { // Callback for when the main window is destroyed. void MainWindowDestroyed(GtkWindow* window, TestShell* shell) { - // TODO(evanm): make WindowList a list of GtkWindow*, so this - // reinterpret_cast isn't necessary. - WindowList::iterator entry = - std::find(TestShell::windowList()->begin(), - TestShell::windowList()->end(), - GTK_WIDGET(window)); - if (entry != TestShell::windowList()->end()) - TestShell::windowList()->erase(entry); + TestShell::RemoveWindowFromList(GTK_WIDGET(window)); if (TestShell::windowList()->empty() || shell->is_modal()) { MessageLoop::current()->PostTask(FROM_HERE, @@ -193,7 +186,8 @@ void TestShell::InteractiveSetFocus(WebWidgetHost* host, bool enable) { } void TestShell::DestroyWindow(gfx::WindowHandle windowHandle) { - NOTIMPLEMENTED(); + RemoveWindowFromList(windowHandle); + gtk_widget_destroy(windowHandle); } WebWidget* TestShell::CreatePopupWidget(WebView* webview) { diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc index d3d4b0d..0ca297ab 100644 --- a/webkit/tools/test_shell/test_shell_win.cc +++ b/webkit/tools/test_shell/test_shell_win.cc @@ -88,6 +88,7 @@ bool TestShell::CreateNewWindow(const std::wstring& startingURL, void TestShell::DestroyWindow(gfx::WindowHandle windowHandle) { // Do we want to tear down some of the machinery behind the scenes too? + RemoveWindowFromList(windowHandle); ::DestroyWindow(windowHandle); } @@ -561,11 +562,7 @@ LRESULT CALLBACK TestShell::WndProc(HWND hwnd, UINT message, WPARAM wParam, // debugging has been enabled. base::MemoryDebug::DumpAllMemoryInUse(); - WindowList::iterator entry = - std::find(TestShell::windowList()->begin(), - TestShell::windowList()->end(), hwnd); - if (entry != TestShell::windowList()->end()) - TestShell::windowList()->erase(entry); + RemoveWindowFromList(hwnd); if (TestShell::windowList()->empty() || shell->is_modal()) { MessageLoop::current()->PostTask(FROM_HERE, |