OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "content/browser/child_process_launcher.h" | 6 #include "content/browser/child_process_launcher.h" |
7 #include "content/browser/renderer_host/render_process_host_impl.h" | 7 #include "content/browser/renderer_host/render_process_host_impl.h" |
8 #include "content/public/browser/navigation_entry.h" | 8 #include "content/public/browser/navigation_entry.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
11 #include "content/public/test/content_browser_test.h" | 11 #include "content/public/test/content_browser_test.h" |
12 #include "content/public/test/content_browser_test_utils.h" | 12 #include "content/public/test/content_browser_test_utils.h" |
13 #include "content/public/test/test_navigation_observer.h" | 13 #include "content/public/test/test_navigation_observer.h" |
14 #include "content/shell/browser/shell.h" | 14 #include "content/shell/browser/shell.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 class MockChildProcessLauncherClient | 18 class MockChildProcessLauncherClient |
19 : public content::ChildProcessLauncher::Client { | 19 : public content::ChildProcessLauncher::Client { |
20 public: | 20 public: |
21 MockChildProcessLauncherClient() | 21 MockChildProcessLauncherClient() |
22 : client_(nullptr), simulate_failure_(false) {} | 22 : client_(nullptr), simulate_failure_(false) {} |
23 | 23 |
24 void OnProcessLaunched() override { | 24 void OnProcessLaunched() override { |
25 if (simulate_failure_) | 25 if (simulate_failure_) |
26 client_->OnProcessLaunchFailed(); | 26 client_->OnProcessLaunchFailed(content::LAUNCH_RESULT_FAILURE); |
27 else | 27 else |
28 client_->OnProcessLaunched(); | 28 client_->OnProcessLaunched(); |
29 }; | 29 }; |
30 void OnProcessLaunchFailed() override { client_->OnProcessLaunchFailed(); }; | 30 |
| 31 void OnProcessLaunchFailed(int error_code) override { |
| 32 client_->OnProcessLaunchFailed(error_code); |
| 33 }; |
31 | 34 |
32 content::ChildProcessLauncher::Client* client_; | 35 content::ChildProcessLauncher::Client* client_; |
33 bool simulate_failure_; | 36 bool simulate_failure_; |
34 }; | 37 }; |
35 | 38 |
36 } | 39 } |
37 | 40 |
38 namespace content { | 41 namespace content { |
39 | 42 |
40 class ChildProcessLauncherBrowserTest : public ContentBrowserTest {}; | 43 class ChildProcessLauncherBrowserTest : public ContentBrowserTest {}; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 TestNavigationObserver nav_observer3(window->web_contents(), 1); | 87 TestNavigationObserver nav_observer3(window->web_contents(), 1); |
85 window->LoadURL(url); | 88 window->LoadURL(url); |
86 nav_observer3.Wait(); | 89 nav_observer3.Wait(); |
87 last_entry = shell()->web_contents()->GetController().GetLastCommittedEntry(); | 90 last_entry = shell()->web_contents()->GetController().GetLastCommittedEntry(); |
88 // Make sure that we navigated to the proper URL. | 91 // Make sure that we navigated to the proper URL. |
89 CHECK(last_entry && last_entry->GetPageType() == PAGE_TYPE_NORMAL); | 92 CHECK(last_entry && last_entry->GetPageType() == PAGE_TYPE_NORMAL); |
90 CHECK(shell()->web_contents()->GetLastCommittedURL() == url); | 93 CHECK(shell()->web_contents()->GetLastCommittedURL() == url); |
91 } | 94 } |
92 | 95 |
93 } // namespace content | 96 } // namespace content |
OLD | NEW |