| 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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 stream << "apiHandle.setValue('" << kQueryString << "');"; | 1227 stream << "apiHandle.setValue('" << kQueryString << "');"; |
| 1228 EXPECT_TRUE(ExecuteScript(stream.str())); | 1228 EXPECT_TRUE(ExecuteScript(stream.str())); |
| 1229 | 1229 |
| 1230 std::string result; | 1230 std::string result; |
| 1231 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), | 1231 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), |
| 1232 "apiHandle.value", | 1232 "apiHandle.value", |
| 1233 &result)); | 1233 &result)); |
| 1234 EXPECT_EQ(kQueryString, result); | 1234 EXPECT_EQ(kQueryString, result); |
| 1235 | 1235 |
| 1236 // Set the query text to the first restricted autocomplete item. | 1236 // Set the query text to the first restricted autocomplete item. |
| 1237 int rid = 0; | 1237 int rid = 1; |
| 1238 stream.str(std::string()); | 1238 stream.str(std::string()); |
| 1239 stream << "apiHandle.setRestrictedValue(" << rid << ")"; | 1239 stream << "apiHandle.setRestrictedValue(" << rid << ")"; |
| 1240 EXPECT_TRUE(ExecuteScript(stream.str())); | 1240 EXPECT_TRUE(ExecuteScript(stream.str())); |
| 1241 | 1241 |
| 1242 // Expect that we now receive the empty string when reading the value back. | 1242 // Expect that we now receive the empty string when reading the value back. |
| 1243 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), | 1243 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), |
| 1244 "apiHandle.value", | 1244 "apiHandle.value", |
| 1245 &result)); | 1245 &result)); |
| 1246 EXPECT_EQ("", result); | 1246 EXPECT_EQ("", result); |
| 1247 | 1247 |
| 1248 // Now set the query text to a non restricted value and ensure that the | 1248 // Now set the query text to a non restricted value and ensure that the |
| 1249 // visibility has been reset and the string can again be read back. | 1249 // visibility has been reset and the string can again be read back. |
| 1250 stream.str(std::string()); | 1250 stream.str(std::string()); |
| 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 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), | 1254 EXPECT_TRUE(GetStringFromJS(instant()->GetOverlayContents(), |
| 1255 "apiHandle.value", | 1255 "apiHandle.value", |
| 1256 &result)); | 1256 &result)); |
| 1257 EXPECT_EQ(kQueryString, result); | 1257 EXPECT_EQ(kQueryString, result); |
| 1258 } | 1258 } |
| OLD | NEW |