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

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

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 browser->tab_strip_model()->GetActiveWebContents(); 83 browser->tab_strip_model()->GetActiveWebContents();
84 NavigationController* controller = &web_contents->GetController(); 84 NavigationController* controller = &web_contents->GetController();
85 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 85 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
86 content::Source<NavigationController>(controller)); 86 content::Source<NavigationController>(controller));
87 registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE, 87 registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE,
88 content::NotificationService::AllSources()); 88 content::NotificationService::AllSources());
89 std::string script(base::StringPrintf( 89 std::string script(base::StringPrintf(
90 "window.domAutomationController.setAutomationId(0);" 90 "window.domAutomationController.setAutomationId(0);"
91 "window.domAutomationController.send(addIFrame(%d, \"%s\"));", 91 "window.domAutomationController.send(addIFrame(%d, \"%s\"));",
92 iframe_id, url.spec().c_str())); 92 iframe_id, url.spec().c_str()));
93 web_contents->GetMainFrame()->ExecuteJavaScriptForTests( 93 web_contents->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(script));
94 base::UTF8ToUTF16(script));
95 content::RunMessageLoop(); 94 content::RunMessageLoop();
96 95
97 EXPECT_EQ(base::StringPrintf("\"%d\"", iframe_id), javascript_response_); 96 EXPECT_EQ(base::StringPrintf("\"%d\"", iframe_id), javascript_response_);
98 registrar_.RemoveAll(); 97 registrar_.RemoveAll();
99 // Now that we loaded the iframe, let's fetch its src. 98 // Now that we loaded the iframe, let's fetch its src.
100 script = base::StringPrintf( 99 script = base::StringPrintf(
101 "window.domAutomationController.send(getIFrameSrc(%d))", iframe_id); 100 "window.domAutomationController.send(getIFrameSrc(%d))", iframe_id);
102 std::string iframe_src; 101 std::string iframe_src;
103 EXPECT_TRUE(content::ExecuteScriptAndExtractString(web_contents, script, 102 EXPECT_TRUE(content::ExecuteScriptAndExtractString(web_contents, script,
104 &iframe_src)); 103 &iframe_src));
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 // Last usage has been updated. 712 // Last usage has been updated.
714 EXPECT_EQ(current_browser() 713 EXPECT_EQ(current_browser()
715 ->profile() 714 ->profile()
716 ->GetHostContentSettingsMap() 715 ->GetHostContentSettingsMap()
717 ->GetLastUsage(current_url().GetOrigin(), 716 ->GetLastUsage(current_url().GetOrigin(),
718 current_url().GetOrigin(), 717 current_url().GetOrigin(),
719 CONTENT_SETTINGS_TYPE_GEOLOCATION) 718 CONTENT_SETTINGS_TYPE_GEOLOCATION)
720 .ToDoubleT(), 719 .ToDoubleT(),
721 13); 720 13);
722 } 721 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc ('k') | chrome/browser/mouseleave_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698