OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/tests/test_var_deprecated.h" | 5 #include "ppapi/tests/test_var_deprecated.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 // Nonexistant ones should return false and not set the exception. | 312 // Nonexistant ones should return false and not set the exception. |
313 ASSERT_FALSE(window.HasProperty("superEvilBit", &exception)); | 313 ASSERT_FALSE(window.HasProperty("superEvilBit", &exception)); |
314 ASSERT_TRUE(exception.is_undefined()); | 314 ASSERT_TRUE(exception.is_undefined()); |
315 ASSERT_FALSE(window.HasMethod("superEvilBit", &exception)); | 315 ASSERT_FALSE(window.HasMethod("superEvilBit", &exception)); |
316 ASSERT_TRUE(exception.is_undefined()); | 316 ASSERT_TRUE(exception.is_undefined()); |
317 | 317 |
318 // Check exception and return false on invalid property name. | 318 // Check exception and return false on invalid property name. |
319 ASSERT_FALSE(window.HasProperty(3.14159, &exception)); | 319 ASSERT_FALSE(window.HasProperty(3.14159, &exception)); |
320 ASSERT_FALSE(exception.is_undefined()); | 320 ASSERT_FALSE(exception.is_undefined()); |
321 exception = pp::Var(); | |
322 | 321 |
323 exception = pp::Var(); | 322 exception = pp::Var(); |
324 ASSERT_FALSE(window.HasMethod(3.14159, &exception)); | 323 ASSERT_FALSE(window.HasMethod(3.14159, &exception)); |
325 ASSERT_FALSE(exception.is_undefined()); | 324 ASSERT_FALSE(exception.is_undefined()); |
326 | 325 |
327 // Try to use something not an object. | 326 // Try to use something not an object. |
328 exception = pp::Var(); | 327 exception = pp::Var(); |
329 pp::VarPrivate string_object("asdf"); | 328 pp::VarPrivate string_object("asdf"); |
330 ASSERT_FALSE(string_object.HasProperty("find", &exception)); | 329 ASSERT_FALSE(string_object.HasProperty("find", &exception)); |
331 ASSERT_FALSE(exception.is_undefined()); | 330 ASSERT_FALSE(exception.is_undefined()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 ASSERT_TRUE(result.is_string()); | 385 ASSERT_TRUE(result.is_string()); |
387 ASSERT_TRUE(result.AsString() == "worksnice"); | 386 ASSERT_TRUE(result.AsString() == "worksnice"); |
388 | 387 |
389 // Reset var_from_page_ so it doesn't seem like a leak to the var leak | 388 // Reset var_from_page_ so it doesn't seem like a leak to the var leak |
390 // checking code. | 389 // checking code. |
391 var_from_page_ = pp::Var(); | 390 var_from_page_ = pp::Var(); |
392 | 391 |
393 PASS(); | 392 PASS(); |
394 } | 393 } |
395 | 394 |
OLD | NEW |