| OLD | NEW |
| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 9 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool PressEnter() { | 136 bool PressEnter() { |
| 137 return ui_test_utils::SendKeyPressSync( | 137 return ui_test_utils::SendKeyPressSync( |
| 138 browser(), ui::VKEY_RETURN, false, false, false, false); | 138 browser(), ui::VKEY_RETURN, false, false, false, false); |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool SetSuggestionsJavascriptArgument(const std::string& argument) { | 141 bool SetSuggestionsJavascriptArgument(const std::string& argument) { |
| 142 std::wstring script = UTF8ToWide(base::StringPrintf( | 142 std::wstring script = UTF8ToWide(base::StringPrintf( |
| 143 "window.setSuggestionsArgument = %s;", argument.c_str())); | 143 "window.setSuggestionsArgument = %s;", argument.c_str())); |
| 144 RenderViewHost* rvh = preview()->web_contents()->GetRenderViewHost(); | 144 content::RenderViewHost* rvh = |
| 145 preview()->web_contents()->GetRenderViewHost(); |
| 145 return ui_test_utils::ExecuteJavaScript(rvh, std::wstring(), script); | 146 return ui_test_utils::ExecuteJavaScript(rvh, std::wstring(), script); |
| 146 } | 147 } |
| 147 | 148 |
| 148 std::wstring WrapScript(const std::string& script) { | 149 std::wstring WrapScript(const std::string& script) { |
| 149 return UTF8ToWide(base::StringPrintf( | 150 return UTF8ToWide(base::StringPrintf( |
| 150 "window.domAutomationController.send(%s)", script.c_str())); | 151 "window.domAutomationController.send(%s)", script.c_str())); |
| 151 } | 152 } |
| 152 | 153 |
| 153 bool GetStringFromJavascript(WebContents* tab, | 154 bool GetStringFromJavascript(WebContents* tab, |
| 154 const std::string& script, | 155 const std::string& script, |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 // Press <Enter> in the omnibox, causing the preview to be committed. | 1002 // Press <Enter> in the omnibox, causing the preview to be committed. |
| 1002 WebContents* preview_tab = preview()->web_contents(); | 1003 WebContents* preview_tab = preview()->web_contents(); |
| 1003 ASSERT_TRUE(PressEnter()); | 1004 ASSERT_TRUE(PressEnter()); |
| 1004 | 1005 |
| 1005 // The preview contents should now be the active tab contents. | 1006 // The preview contents should now be the active tab contents. |
| 1006 EXPECT_FALSE(preview()); | 1007 EXPECT_FALSE(preview()); |
| 1007 EXPECT_FALSE(instant()->is_displayable()); | 1008 EXPECT_FALSE(instant()->is_displayable()); |
| 1008 EXPECT_FALSE(instant()->IsCurrent()); | 1009 EXPECT_FALSE(instant()->IsCurrent()); |
| 1009 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); | 1010 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); |
| 1010 } | 1011 } |
| OLD | NEW |