| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 compromised_renderer->GetProcess()->GetChannel(), evil); | 413 compromised_renderer->GetProcess()->GetChannel(), evil); |
| 414 | 414 |
| 415 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 415 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 416 ASSERT_EQ("evil", message) | 416 ASSERT_EQ("evil", message) |
| 417 << "Automation message should be received by WebContents."; | 417 << "Automation message should be received by WebContents."; |
| 418 ASSERT_EQ("\"okay\"", interstitial->last_command()) | 418 ASSERT_EQ("\"okay\"", interstitial->last_command()) |
| 419 << "Interstitial should not be affected."; | 419 << "Interstitial should not be affected."; |
| 420 | 420 |
| 421 // Send a second message from the interstitial page, and make sure that the | 421 // Send a second message from the interstitial page, and make sure that the |
| 422 // "evil" message doesn't arrive in the intervening period. | 422 // "evil" message doesn't arrive in the intervening period. |
| 423 ASSERT_TRUE(ExecuteScript(interstitial_page->GetMainFrame(), | 423 ExecuteScriptAsync(interstitial_page->GetMainFrame(), |
| 424 "window.domAutomationController.send(\"okay2\");")); | 424 "window.domAutomationController.send(\"okay2\");"); |
| 425 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 425 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 426 ASSERT_EQ("\"okay2\"", message); | 426 ASSERT_EQ("\"okay2\"", message); |
| 427 ASSERT_EQ("\"okay2\"", interstitial->last_command()); | 427 ASSERT_EQ("\"okay2\"", interstitial->last_command()); |
| 428 } | 428 } |
| 429 | 429 |
| 430 // Intercepts the HTTP origin header and on being invoked once it is found | 430 // Intercepts the HTTP origin header and on being invoked once it is found |
| 431 // aborts the requeest. | 431 // aborts the requeest. |
| 432 void OnHttpHeaderReceived(const std::string& header, | 432 void OnHttpHeaderReceived(const std::string& header, |
| 433 const std::string& value, | 433 const std::string& value, |
| 434 int child_process_id, | 434 int child_process_id, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 // |target_url|. | 634 // |target_url|. |
| 635 WaitForLoadStop(shell()->web_contents()); | 635 WaitForLoadStop(shell()->web_contents()); |
| 636 EXPECT_EQ(start_url, root->current_frame_host()->GetLastCommittedURL()); | 636 EXPECT_EQ(start_url, root->current_frame_host()->GetLastCommittedURL()); |
| 637 | 637 |
| 638 // Verify that the malicious renderer got killed. | 638 // Verify that the malicious renderer got killed. |
| 639 exit_observer.Wait(); | 639 exit_observer.Wait(); |
| 640 EXPECT_FALSE(exit_observer.did_exit_normally()); | 640 EXPECT_FALSE(exit_observer.did_exit_normally()); |
| 641 } | 641 } |
| 642 | 642 |
| 643 } // namespace content | 643 } // namespace content |
| OLD | NEW |