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_handleScope(v8::Isolate::GetCurrent()) | 96 : m_scope(V8BindingTestScope::create(v8::Isolate::GetCurrent())) |
97 , m_scope(v8::Context::New(v8::Isolate::GetCurrent())) | |
98 { | 97 { |
99 } | 98 } |
100 | |
101 private: | 99 private: |
102 v8::HandleScope m_handleScope; | 100 OwnPtr<V8BindingTestScope> m_scope; |
103 v8::Context::Scope m_scope; | |
104 }; | 101 }; |
105 | 102 |
106 TEST_F(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) | 103 TEST_F(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) |
107 { | 104 { |
108 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 105 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
109 v8::Local<v8::Object> object = v8::Object::New(isolate); | 106 v8::Local<v8::Object> object = v8::Object::New(isolate); |
110 object->Set(v8AtomicString(isolate, "foo"), v8AtomicString(isolate, "zoo")); | 107 object->Set(v8AtomicString(isolate, "foo"), v8AtomicString(isolate, "zoo")); |
111 | 108 |
112 ScriptValue scriptValue(object, isolate); | 109 ScriptValue scriptValue(object, isolate); |
113 | 110 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 checkInjection(IDBKey::createDate(4567), scriptObject, "foo.baz"); | 168 checkInjection(IDBKey::createDate(4567), scriptObject, "foo.baz"); |
172 checkInjection(IDBKey::createDate(4567), scriptObject, "bar"); | 169 checkInjection(IDBKey::createDate(4567), scriptObject, "bar"); |
173 checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "foo.b
az"); | 170 checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "foo.b
az"); |
174 checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "bar")
; | 171 checkInjection(IDBKey::createArray(IDBKey::KeyArray()), scriptObject, "bar")
; |
175 | 172 |
176 checkInjectionFails(IDBKey::createString("zoo"), scriptObject, "foo.bar.baz"
); | 173 checkInjectionFails(IDBKey::createString("zoo"), scriptObject, "foo.bar.baz"
); |
177 checkInjection(IDBKey::createString("zoo"), scriptObject, "foo.xyz.foo"); | 174 checkInjection(IDBKey::createString("zoo"), scriptObject, "foo.xyz.foo"); |
178 } | 175 } |
179 | 176 |
180 } // namespace | 177 } // namespace |
OLD | NEW |