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

Side by Side Diff: content/browser/security_exploit_browsertest.cc

Issue 2478803003: Remove DOMAutomationController::automation_id_ (Closed)
Patch Set: More of: Fixing issues caught by extra |expected_response| checks in ExecuteScript function. Created 3 years, 5 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
OLDNEW
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 compromised_renderer->GetProcess()->GetChannel(), evil); 395 compromised_renderer->GetProcess()->GetChannel(), evil);
396 396
397 ASSERT_TRUE(message_queue.WaitForMessage(&message)); 397 ASSERT_TRUE(message_queue.WaitForMessage(&message));
398 ASSERT_EQ("evil", message) 398 ASSERT_EQ("evil", message)
399 << "Automation message should be received by WebContents."; 399 << "Automation message should be received by WebContents.";
400 ASSERT_EQ("\"okay\"", interstitial->last_command()) 400 ASSERT_EQ("\"okay\"", interstitial->last_command())
401 << "Interstitial should not be affected."; 401 << "Interstitial should not be affected.";
402 402
403 // Send a second message from the interstitial page, and make sure that the 403 // Send a second message from the interstitial page, and make sure that the
404 // "evil" message doesn't arrive in the intervening period. 404 // "evil" message doesn't arrive in the intervening period.
405 ASSERT_TRUE(ExecuteScript(interstitial_page->GetMainFrame(), 405 ExecuteUnmodifiedScript(interstitial_page->GetMainFrame(),
406 "window.domAutomationController.send(\"okay2\");")); 406 "window.domAutomationController.send(\"okay2\");");
407 ASSERT_TRUE(message_queue.WaitForMessage(&message)); 407 ASSERT_TRUE(message_queue.WaitForMessage(&message));
408 ASSERT_EQ("\"okay2\"", message); 408 ASSERT_EQ("\"okay2\"", message);
409 ASSERT_EQ("\"okay2\"", interstitial->last_command()); 409 ASSERT_EQ("\"okay2\"", interstitial->last_command());
410 } 410 }
411 411
412 // Intercepts the HTTP origin header and on being invoked once it is found 412 // Intercepts the HTTP origin header and on being invoked once it is found
413 // aborts the requeest. 413 // aborts the requeest.
414 void OnHttpHeaderReceived(const std::string& header, 414 void OnHttpHeaderReceived(const std::string& header,
415 const std::string& value, 415 const std::string& value,
416 int child_process_id, 416 int child_process_id,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // |target_url|. 608 // |target_url|.
609 WaitForLoadStop(shell()->web_contents()); 609 WaitForLoadStop(shell()->web_contents());
610 EXPECT_EQ(start_url, root->current_frame_host()->GetLastCommittedURL()); 610 EXPECT_EQ(start_url, root->current_frame_host()->GetLastCommittedURL());
611 611
612 // Verify that the malicious renderer got killed. 612 // Verify that the malicious renderer got killed.
613 exit_observer.Wait(); 613 exit_observer.Wait();
614 EXPECT_FALSE(exit_observer.did_exit_normally()); 614 EXPECT_FALSE(exit_observer.did_exit_normally());
615 } 615 }
616 616
617 } // namespace content 617 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698