OLD | NEW |
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/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 #include <vector> | 11 #include <vector> |
9 | 12 |
10 #include "base/command_line.h" | 13 #include "base/command_line.h" |
11 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" |
12 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/pattern.h" | 17 #include "base/strings/pattern.h" |
14 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
16 #include "base/test/test_timeouts.h" | 20 #include "base/test/test_timeouts.h" |
17 #include "base/thread_task_runner_handle.h" | 21 #include "base/thread_task_runner_handle.h" |
| 22 #include "build/build_config.h" |
18 #include "content/browser/frame_host/cross_process_frame_connector.h" | 23 #include "content/browser/frame_host/cross_process_frame_connector.h" |
19 #include "content/browser/frame_host/frame_tree.h" | 24 #include "content/browser/frame_host/frame_tree.h" |
20 #include "content/browser/frame_host/navigator.h" | 25 #include "content/browser/frame_host/navigator.h" |
21 #include "content/browser/frame_host/render_frame_proxy_host.h" | 26 #include "content/browser/frame_host/render_frame_proxy_host.h" |
22 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 27 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
23 #include "content/browser/gpu/compositor_util.h" | 28 #include "content/browser/gpu/compositor_util.h" |
24 #include "content/browser/renderer_host/render_view_host_impl.h" | 29 #include "content/browser/renderer_host/render_view_host_impl.h" |
25 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 30 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
26 #include "content/browser/web_contents/web_contents_impl.h" | 31 #include "content/browser/web_contents/web_contents_impl.h" |
27 #include "content/common/frame_messages.h" | 32 #include "content/common/frame_messages.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 public: | 449 public: |
445 ConsoleObserverDelegate(WebContents* web_contents, const std::string& filter) | 450 ConsoleObserverDelegate(WebContents* web_contents, const std::string& filter) |
446 : web_contents_(web_contents), | 451 : web_contents_(web_contents), |
447 filter_(filter), | 452 filter_(filter), |
448 message_(""), | 453 message_(""), |
449 message_loop_runner_(new MessageLoopRunner) {} | 454 message_loop_runner_(new MessageLoopRunner) {} |
450 | 455 |
451 ~ConsoleObserverDelegate() override {} | 456 ~ConsoleObserverDelegate() override {} |
452 | 457 |
453 bool AddMessageToConsole(WebContents* source, | 458 bool AddMessageToConsole(WebContents* source, |
454 int32 level, | 459 int32_t level, |
455 const base::string16& message, | 460 const base::string16& message, |
456 int32 line_no, | 461 int32_t line_no, |
457 const base::string16& source_id) override; | 462 const base::string16& source_id) override; |
458 | 463 |
459 std::string message() { return message_; } | 464 std::string message() { return message_; } |
460 | 465 |
461 void Wait(); | 466 void Wait(); |
462 | 467 |
463 private: | 468 private: |
464 WebContents* web_contents_; | 469 WebContents* web_contents_; |
465 std::string filter_; | 470 std::string filter_; |
466 std::string message_; | 471 std::string message_; |
467 | 472 |
468 // The MessageLoopRunner used to spin the message loop. | 473 // The MessageLoopRunner used to spin the message loop. |
469 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 474 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
470 | 475 |
471 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); | 476 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); |
472 }; | 477 }; |
473 | 478 |
474 void ConsoleObserverDelegate::Wait() { | 479 void ConsoleObserverDelegate::Wait() { |
475 message_loop_runner_->Run(); | 480 message_loop_runner_->Run(); |
476 } | 481 } |
477 | 482 |
478 bool ConsoleObserverDelegate::AddMessageToConsole( | 483 bool ConsoleObserverDelegate::AddMessageToConsole( |
479 WebContents* source, | 484 WebContents* source, |
480 int32 level, | 485 int32_t level, |
481 const base::string16& message, | 486 const base::string16& message, |
482 int32 line_no, | 487 int32_t line_no, |
483 const base::string16& source_id) { | 488 const base::string16& source_id) { |
484 DCHECK(source == web_contents_); | 489 DCHECK(source == web_contents_); |
485 | 490 |
486 std::string ascii_message = base::UTF16ToASCII(message); | 491 std::string ascii_message = base::UTF16ToASCII(message); |
487 if (base::MatchPattern(ascii_message, filter_)) { | 492 if (base::MatchPattern(ascii_message, filter_)) { |
488 message_ = ascii_message; | 493 message_ = ascii_message; |
489 message_loop_runner_->Quit(); | 494 message_loop_runner_->Quit(); |
490 } | 495 } |
491 return false; | 496 return false; |
492 } | 497 } |
(...skipping 4157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4650 // Therefore, navigate the remaining subframe to completely different site, | 4655 // Therefore, navigate the remaining subframe to completely different site, |
4651 // which will cause the original process to exit cleanly. | 4656 // which will cause the original process to exit cleanly. |
4652 NavigateFrameToURL( | 4657 NavigateFrameToURL( |
4653 web_contents->GetFrameTree()->root()->child_at(0), | 4658 web_contents->GetFrameTree()->root()->child_at(0), |
4654 embedded_test_server()->GetURL("d.com", "/title3.html")); | 4659 embedded_test_server()->GetURL("d.com", "/title3.html")); |
4655 watcher.Wait(); | 4660 watcher.Wait(); |
4656 EXPECT_TRUE(watcher.did_exit_normally()); | 4661 EXPECT_TRUE(watcher.did_exit_normally()); |
4657 } | 4662 } |
4658 | 4663 |
4659 } // namespace content | 4664 } // namespace content |
OLD | NEW |