| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 { | 86 { |
| 87 RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); | 87 RefPtr<IDBKey> idbKey = checkKeyFromValueAndKeyPathInternal(value, keyPath); |
| 88 ASSERT_TRUE(idbKey.get()); | 88 ASSERT_TRUE(idbKey.get()); |
| 89 ASSERT_EQ(IDBKey::NumberType, idbKey->type()); | 89 ASSERT_EQ(IDBKey::NumberType, idbKey->type()); |
| 90 ASSERT_TRUE(expected == idbKey->number()); | 90 ASSERT_TRUE(expected == idbKey->number()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 class IDBKeyFromValueAndKeyPathTest : public testing::Test { | 93 class IDBKeyFromValueAndKeyPathTest : public testing::Test { |
| 94 public: | 94 public: |
| 95 IDBKeyFromValueAndKeyPathTest() | 95 IDBKeyFromValueAndKeyPathTest() |
| 96 : m_scope(V8BindingTestScope::create(v8::Isolate::GetCurrent())) | 96 : m_handleScope(v8::Isolate::GetCurrent()) |
| 97 , m_scope(v8::Context::New(v8::Isolate::GetCurrent())) |
| 97 { | 98 { |
| 98 } | 99 } |
| 100 |
| 99 private: | 101 private: |
| 100 OwnPtr<V8BindingTestScope> m_scope; | 102 v8::HandleScope m_handleScope; |
| 103 v8::Context::Scope m_scope; |
| 101 }; | 104 }; |
| 102 | 105 |
| 103 TEST_F(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) | 106 TEST_F(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) |
| 104 { | 107 { |
| 105 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 108 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 106 v8::Local<v8::Object> object = v8::Object::New(isolate); | 109 v8::Local<v8::Object> object = v8::Object::New(isolate); |
| 107 object->Set(v8AtomicString(isolate, "foo"), v8AtomicString(isolate, "zoo")); | 110 object->Set(v8AtomicString(isolate, "foo"), v8AtomicString(isolate, "zoo")); |
| 108 | 111 |
| 109 ScriptValue scriptValue(object, isolate); | 112 ScriptValue scriptValue(object, isolate); |
| 110 | 113 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 checkInjection(IDBKey::createDate(4567), scriptObject, "foo.baz"); | 171 checkInjection(IDBKey::createDate(4567), scriptObject, "foo.baz"); |
| 169 checkInjection(IDBKey::createDate(4567), scriptObject, "bar"); | 172 checkInjection(IDBKey::createDate(4567), scriptObject, "bar"); |
| 170 checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "foo.b
az"); | 173 checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "foo.b
az"); |
| 171 checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "bar")
; | 174 checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "bar")
; |
| 172 | 175 |
| 173 checkInjectionFails(IDBKey::createString("zoo"), scriptObject, "foo.bar.baz"
); | 176 checkInjectionFails(IDBKey::createString("zoo"), scriptObject, "foo.bar.baz"
); |
| 174 checkInjection(IDBKey::createString("zoo"), scriptObject, "foo.xyz.foo"); | 177 checkInjection(IDBKey::createString("zoo"), scriptObject, "foo.xyz.foo"); |
| 175 } | 178 } |
| 176 | 179 |
| 177 } // namespace | 180 } // namespace |
| OLD | NEW |