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

Side by Side Diff: chrome/browser/geolocation/geolocation_browsertest.cc

Issue 2503453003: Remove all calls to domAutomationController.setAutomationId.
Patch Set: Fix nacl_browsertest_util.cc 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) 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 : navigation_completed_(false), 89 : navigation_completed_(false),
90 javascript_completed_(false) { 90 javascript_completed_(false) {
91 content::WebContents* web_contents = 91 content::WebContents* web_contents =
92 browser->tab_strip_model()->GetActiveWebContents(); 92 browser->tab_strip_model()->GetActiveWebContents();
93 content::NavigationController* controller = &web_contents->GetController(); 93 content::NavigationController* controller = &web_contents->GetController();
94 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 94 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
95 content::Source<content::NavigationController>(controller)); 95 content::Source<content::NavigationController>(controller));
96 registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE, 96 registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE,
97 content::NotificationService::AllSources()); 97 content::NotificationService::AllSources());
98 std::string script(base::StringPrintf( 98 std::string script(base::StringPrintf(
99 "window.domAutomationController.setAutomationId(0);"
100 "window.domAutomationController.send(addIFrame(%d, \"%s\"));", 99 "window.domAutomationController.send(addIFrame(%d, \"%s\"));",
101 iframe_id, url.spec().c_str())); 100 iframe_id, url.spec().c_str()));
102 web_contents->GetMainFrame()->ExecuteJavaScriptForTests( 101 web_contents->GetMainFrame()->ExecuteJavaScriptForTests(
103 base::UTF8ToUTF16(script)); 102 base::UTF8ToUTF16(script));
104 content::RunMessageLoop(); 103 content::RunMessageLoop();
105 104
106 EXPECT_EQ(base::StringPrintf("\"%d\"", iframe_id), javascript_response_); 105 EXPECT_EQ(base::StringPrintf("\"%d\"", iframe_id), javascript_response_);
107 registrar_.RemoveAll(); 106 registrar_.RemoveAll();
108 // Now that we loaded the iframe, let's fetch its src. 107 // Now that we loaded the iframe, let's fetch its src.
109 script = base::StringPrintf( 108 script = base::StringPrintf(
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT)); 734 ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT));
736 WatchPositionAndObservePermissionRequest(true); 735 WatchPositionAndObservePermissionRequest(true);
737 736
738 // TODO(mvanouwerkerk): Can't close a window you did not open. Maybe this was 737 // TODO(mvanouwerkerk): Can't close a window you did not open. Maybe this was
739 // valid when the test was written, but now it just prints "Scripts may close 738 // valid when the test was written, but now it just prints "Scripts may close
740 // only the windows that were opened by it." 739 // only the windows that were opened by it."
741 std::string script = "window.domAutomationController.send(window.close())"; 740 std::string script = "window.domAutomationController.send(window.close())";
742 ASSERT_TRUE(content::ExecuteScript( 741 ASSERT_TRUE(content::ExecuteScript(
743 current_browser()->tab_strip_model()->GetActiveWebContents(), script)); 742 current_browser()->tab_strip_model()->GetActiveWebContents(), script));
744 } 743 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698