OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 stream << "apiHandle.setValue('" << kQueryString << "');"; | 1251 stream << "apiHandle.setValue('" << kQueryString << "');"; |
1252 EXPECT_TRUE(ExecuteScript(stream.str())); | 1252 EXPECT_TRUE(ExecuteScript(stream.str())); |
1253 | 1253 |
1254 std::string result; | 1254 std::string result; |
1255 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), | 1255 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), |
1256 "apiHandle.value", | 1256 "apiHandle.value", |
1257 &result)); | 1257 &result)); |
1258 EXPECT_EQ(kQueryString, result); | 1258 EXPECT_EQ(kQueryString, result); |
1259 | 1259 |
1260 // Set the query text to the first restricted autocomplete item. | 1260 // Set the query text to the first restricted autocomplete item. |
1261 int rid = 0; | 1261 int rid = 1; |
1262 stream.str(std::string()); | 1262 stream.str(std::string()); |
1263 stream << "apiHandle.setRestrictedValue(" << rid << ")"; | 1263 stream << "apiHandle.setRestrictedValue(" << rid << ")"; |
1264 EXPECT_TRUE(ExecuteScript(stream.str())); | 1264 EXPECT_TRUE(ExecuteScript(stream.str())); |
1265 | 1265 |
1266 // Expect that we now receive the empty string when reading the value back. | 1266 // Expect that we now receive the empty string when reading the value back. |
1267 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), | 1267 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), |
1268 "apiHandle.value", | 1268 "apiHandle.value", |
1269 &result)); | 1269 &result)); |
1270 EXPECT_EQ("", result); | 1270 EXPECT_EQ("", result); |
1271 | 1271 |
(...skipping 18 matching lines...) Expand all Loading... |
1290 content::WebContents* overlay = instant()->GetOverlayContents(); | 1290 content::WebContents* overlay = instant()->GetOverlayContents(); |
1291 EXPECT_TRUE(UpdateSearchState(overlay)); | 1291 EXPECT_TRUE(UpdateSearchState(overlay)); |
1292 EXPECT_EQ(0, on_native_suggestions_calls_); | 1292 EXPECT_EQ(0, on_native_suggestions_calls_); |
1293 | 1293 |
1294 SetOmniboxTextAndWaitForOverlayToShow("railroad"); | 1294 SetOmniboxTextAndWaitForOverlayToShow("railroad"); |
1295 | 1295 |
1296 EXPECT_EQ(overlay, instant()->GetOverlayContents()); | 1296 EXPECT_EQ(overlay, instant()->GetOverlayContents()); |
1297 EXPECT_TRUE(UpdateSearchState(overlay)); | 1297 EXPECT_TRUE(UpdateSearchState(overlay)); |
1298 EXPECT_EQ(1, on_native_suggestions_calls_); | 1298 EXPECT_EQ(1, on_native_suggestions_calls_); |
1299 } | 1299 } |
OLD | NEW |