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 <windows.h> | 7 #include <windows.h> |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <commdlg.h> | 9 #include <commdlg.h> |
10 #include <objbase.h> | 10 #include <objbase.h> |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 224 |
225 // Load the test file into the first available window. | 225 // Load the test file into the first available window. |
226 if (TestShell::windowList()->empty()) { | 226 if (TestShell::windowList()->empty()) { |
227 LOG(ERROR) << "No windows open."; | 227 LOG(ERROR) << "No windows open."; |
228 return false; | 228 return false; |
229 } | 229 } |
230 | 230 |
231 HWND hwnd = *(TestShell::windowList()->begin()); | 231 HWND hwnd = *(TestShell::windowList()->begin()); |
232 TestShell* shell = | 232 TestShell* shell = |
233 static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); | 233 static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); |
234 shell->ResetTestController(); | |
235 | 234 |
236 // ResetTestController may have closed the window we were holding on to. | |
237 // Grab the first window again. | |
238 hwnd = *(TestShell::windowList()->begin()); | 235 hwnd = *(TestShell::windowList()->begin()); |
tony
2009/02/24 23:33:45
Nit: Should we move these three lines and the comm
| |
239 shell = static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); | 236 shell = static_cast<TestShell*>(win_util::GetWindowUserData(hwnd)); |
240 DCHECK(shell); | 237 DCHECK(shell); |
241 | 238 |
242 // Clear focus between tests. | 239 // Clear focus between tests. |
243 shell->m_focusedWidgetHost = NULL; | 240 shell->m_focusedWidgetHost = NULL; |
244 | 241 |
245 // Make sure the previous load is stopped. | 242 // Make sure the previous load is stopped. |
246 shell->webView()->StopLoading(); | 243 shell->webView()->StopLoading(); |
247 shell->navigation_controller()->Reset(); | 244 shell->navigation_controller()->Reset(); |
248 | 245 |
246 // StopLoading may update state maintained in the test controller (for | |
247 // example, whether the WorkQueue is frozen) as such, we need to reset it | |
248 // after we invoke StopLoading. | |
249 shell->ResetTestController(); | |
250 | |
249 // Clean up state between test runs. | 251 // Clean up state between test runs. |
250 webkit_glue::ResetBeforeTestRun(shell->webView()); | 252 webkit_glue::ResetBeforeTestRun(shell->webView()); |
251 ResetWebPreferences(); | 253 ResetWebPreferences(); |
252 shell->webView()->SetPreferences(*web_prefs_); | 254 shell->webView()->SetPreferences(*web_prefs_); |
253 | 255 |
254 SetWindowPos(shell->m_mainWnd, NULL, | 256 SetWindowPos(shell->m_mainWnd, NULL, |
255 kTestWindowXLocation, kTestWindowYLocation, 0, 0, | 257 kTestWindowXLocation, kTestWindowYLocation, 0, 0, |
256 SWP_NOSIZE | SWP_NOZORDER); | 258 SWP_NOSIZE | SWP_NOZORDER); |
257 shell->ResizeSubViews(); | 259 shell->ResizeSubViews(); |
258 | 260 |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 | 749 |
748 bool EnsureFontLoaded(HFONT font) { | 750 bool EnsureFontLoaded(HFONT font) { |
749 return true; | 751 return true; |
750 } | 752 } |
751 | 753 |
752 bool DownloadUrl(const std::string& url, HWND caller_window) { | 754 bool DownloadUrl(const std::string& url, HWND caller_window) { |
753 return false; | 755 return false; |
754 } | 756 } |
755 | 757 |
756 } // namespace webkit_glue | 758 } // namespace webkit_glue |
OLD | NEW |