Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: content/shell/webkit_test_controller.cc

Issue 13998012: [content shell] gracefully deal with process switches (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/shell/webkit_test_controller.h" 5 #include "content/shell/webkit_test_controller.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/process_util.h" 11 #include "base/process_util.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "content/public/browser/devtools_manager.h" 15 #include "content/public/browser/devtools_manager.h"
16 #include "content/public/browser/gpu_data_manager.h" 16 #include "content/public/browser/gpu_data_manager.h"
17 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_types.h" 20 #include "content/public/browser/notification_types.h"
21 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/render_widget_host_view.h" 23 #include "content/public/browser/render_widget_host_view.h"
24 #include "content/public/browser/site_instance.h"
24 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
25 #include "content/shell/shell.h" 26 #include "content/shell/shell.h"
26 #include "content/shell/shell_browser_context.h" 27 #include "content/shell/shell_browser_context.h"
27 #include "content/shell/shell_content_browser_client.h" 28 #include "content/shell/shell_content_browser_client.h"
28 #include "content/shell/shell_messages.h" 29 #include "content/shell/shell_messages.h"
29 #include "content/shell/shell_switches.h" 30 #include "content/shell/shell_switches.h"
30 #include "content/shell/webkit_test_helpers.h" 31 #include "content/shell/webkit_test_helpers.h"
31 #include "webkit/glue/glue_serialize.h" 32 #include "webkit/glue/glue_serialize.h"
32 #include "webkit/support/webkit_support_gfx.h" 33 #include "webkit/support/webkit_support_gfx.h"
33 34
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 test_url_ = test_url; 207 test_url_ = test_url;
207 printer_->reset(); 208 printer_->reset();
208 ShellBrowserContext* browser_context = 209 ShellBrowserContext* browser_context =
209 ShellContentBrowserClient::Get()->browser_context(); 210 ShellContentBrowserClient::Get()->browser_context();
210 if (test_url.spec().find("compositing/") != std::string::npos) 211 if (test_url.spec().find("compositing/") != std::string::npos)
211 is_compositing_test_ = true; 212 is_compositing_test_ = true;
212 gfx::Size initial_size(kTestWindowWidthDip, kTestWindowHeightDip); 213 gfx::Size initial_size(kTestWindowWidthDip, kTestWindowHeightDip);
213 // The W3C SVG layout tests use a different size than the other layout tests. 214 // The W3C SVG layout tests use a different size than the other layout tests.
214 if (test_url.spec().find("W3C-SVG-1.1") != std::string::npos) 215 if (test_url.spec().find("W3C-SVG-1.1") != std::string::npos)
215 initial_size = gfx::Size(kTestSVGWindowWidthDip, kTestSVGWindowHeightDip); 216 initial_size = gfx::Size(kTestSVGWindowWidthDip, kTestSVGWindowHeightDip);
217 if (main_window_ &&
218 !SiteInstance::IsSameWebSite(
219 browser_context,
220 main_window_->web_contents()->GetSiteInstance()->GetSiteURL(),
221 test_url)) {
222 base::RunLoop run_loop;
223 DiscardMainWindow();
224 run_loop.Run();
225 }
216 if (!main_window_) { 226 if (!main_window_) {
217 main_window_ = content::Shell::CreateNewWindow( 227 main_window_ = content::Shell::CreateNewWindow(
218 browser_context, 228 browser_context,
219 GURL(), 229 GURL(),
220 NULL, 230 NULL,
221 MSG_ROUTING_NONE, 231 MSG_ROUTING_NONE,
222 initial_size); 232 initial_size);
223 WebContentsObserver::Observe(main_window_->web_contents()); 233 WebContentsObserver::Observe(main_window_->web_contents());
224 send_configuration_to_next_host_ = true; 234 send_configuration_to_next_host_ = true;
225 current_pid_ = base::kNullProcessId; 235 current_pid_ = base::kNullProcessId;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 open_windows[i]->Close(); 626 open_windows[i]->Close();
617 } 627 }
618 MessageLoop::current()->RunUntilIdle(); 628 MessageLoop::current()->RunUntilIdle();
619 } 629 }
620 630
621 void WebKitTestController::OnResetDone() { 631 void WebKitTestController::OnResetDone() {
622 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 632 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
623 } 633 }
624 634
625 } // namespace content 635 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698