OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "webkit/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <fontconfig/fontconfig.h> | 9 #include <fontconfig/fontconfig.h> |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 /* static */ bool TestShell::RunFileTest(const TestParams& params) { | 499 /* static */ bool TestShell::RunFileTest(const TestParams& params) { |
500 // Load the test file into the first available window. | 500 // Load the test file into the first available window. |
501 if (TestShell::windowList()->empty()) { | 501 if (TestShell::windowList()->empty()) { |
502 LOG(ERROR) << "No windows open."; | 502 LOG(ERROR) << "No windows open."; |
503 return false; | 503 return false; |
504 } | 504 } |
505 | 505 |
506 GtkWindow* window = *(TestShell::windowList()->begin()); | 506 GtkWindow* window = *(TestShell::windowList()->begin()); |
507 TestShell* shell = | 507 TestShell* shell = |
508 static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell")) ; | 508 static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shell")) ; |
509 shell->ResetTestController(); | |
510 | |
511 // ResetTestController may have closed the window we were holding on to. | |
512 // Grab the first window again. | |
513 window = *(TestShell::windowList()->begin()); | |
514 shell = static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), "test-shel l")); | |
515 DCHECK(shell); | |
516 | 509 |
517 // Clear focus between tests. | 510 // Clear focus between tests. |
518 shell->m_focusedWidgetHost = NULL; | 511 shell->m_focusedWidgetHost = NULL; |
519 | 512 |
520 // Make sure the previous load is stopped. | 513 // Make sure the previous load is stopped. |
521 shell->webView()->mainFrame()->stopLoading(); | 514 shell->webView()->mainFrame()->stopLoading(); |
522 shell->navigation_controller()->Reset(); | 515 shell->navigation_controller()->Reset(); |
523 | 516 |
517 // StopLoading may update state maintained in the test controller (for | |
518 // example, whether the WorkQueue is frozen) as such, we need to reset it | |
519 // after we invoke StopLoading. | |
520 shell->ResetTestController(); | |
521 | |
522 // ResetTestController may have closed the window we were holding on to. | |
523 // Grab the first window again. | |
524 window = *(TestShell::windowList()->begin()); | |
agl
2010/05/27 14:30:40
in CL 27109, grabbing the window again occurs befo
bulach
2010/05/27 14:42:26
ops, sorry, I should've clarified: sky addressed t
| |
525 shell = static_cast<TestShell*>(g_object_get_data(G_OBJECT(window), | |
526 "test-shell")); | |
527 DCHECK(shell); | |
528 | |
524 // Clean up state between test runs. | 529 // Clean up state between test runs. |
525 webkit_glue::ResetBeforeTestRun(shell->webView()); | 530 webkit_glue::ResetBeforeTestRun(shell->webView()); |
526 ResetWebPreferences(); | 531 ResetWebPreferences(); |
527 web_prefs_->Apply(shell->webView()); | 532 web_prefs_->Apply(shell->webView()); |
528 | 533 |
529 // TODO(agl): Maybe make the window hidden in the future. Window does this | 534 // TODO(agl): Maybe make the window hidden in the future. Window does this |
530 // by positioning it off the screen but the GTK function to do this is | 535 // by positioning it off the screen but the GTK function to do this is |
531 // deprecated and appears to have been removed. | 536 // deprecated and appears to have been removed. |
532 | 537 |
533 shell->ResizeSubViews(); | 538 shell->ResizeSubViews(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 break; | 653 break; |
649 } | 654 } |
650 return TestShell::NetResourceProvider(resource_id); | 655 return TestShell::NetResourceProvider(resource_id); |
651 } | 656 } |
652 | 657 |
653 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { | 658 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { |
654 NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); | 659 NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); |
655 } | 660 } |
656 | 661 |
657 } // namespace webkit_glue | 662 } // namespace webkit_glue |
OLD | NEW |