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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 { | 83 { |
84 IDBKey* idbKey = checkKeyFromValueAndKeyPathInternal(isolate, value, keyPath
); | 84 IDBKey* idbKey = checkKeyFromValueAndKeyPathInternal(isolate, value, keyPath
); |
85 ASSERT_TRUE(idbKey); | 85 ASSERT_TRUE(idbKey); |
86 ASSERT_EQ(IDBKey::NumberType, idbKey->type()); | 86 ASSERT_EQ(IDBKey::NumberType, idbKey->type()); |
87 ASSERT_TRUE(expected == idbKey->number()); | 87 ASSERT_TRUE(expected == idbKey->number()); |
88 } | 88 } |
89 | 89 |
90 class IDBKeyFromValueAndKeyPathTest : public testing::Test { | 90 class IDBKeyFromValueAndKeyPathTest : public testing::Test { |
91 public: | 91 public: |
92 IDBKeyFromValueAndKeyPathTest() | 92 IDBKeyFromValueAndKeyPathTest() |
93 : m_scope(V8TestingScope::create(v8::Isolate::GetCurrent())) | 93 : m_scope(v8::Isolate::GetCurrent()) |
94 { | 94 { |
95 } | 95 } |
96 private: | 96 private: |
97 OwnPtr<V8TestingScope> m_scope; | 97 V8TestingScope m_scope; |
98 }; | 98 }; |
99 | 99 |
100 TEST_F(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) | 100 TEST_F(IDBKeyFromValueAndKeyPathTest, TopLevelPropertyStringValue) |
101 { | 101 { |
102 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 102 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
103 v8::Local<v8::Object> object = v8::Object::New(isolate); | 103 v8::Local<v8::Object> object = v8::Object::New(isolate); |
104 object->Set(v8AtomicString(isolate, "foo"), v8AtomicString(isolate, "zoo")); | 104 object->Set(v8AtomicString(isolate, "foo"), v8AtomicString(isolate, "zoo")); |
105 | 105 |
106 ScriptValue scriptValue(ScriptState::current(isolate), object); | 106 ScriptValue scriptValue(ScriptState::current(isolate), object); |
107 | 107 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 checkInjection(scriptState, IDBKey::createDate(4567), scriptObject, "foo.baz
"); | 167 checkInjection(scriptState, IDBKey::createDate(4567), scriptObject, "foo.baz
"); |
168 checkInjection(scriptState, IDBKey::createDate(4567), scriptObject, "bar"); | 168 checkInjection(scriptState, IDBKey::createDate(4567), scriptObject, "bar"); |
169 checkInjection(scriptState, IDBKey::createArray(IDBKey::KeyArray()), scriptO
bject, "foo.baz"); | 169 checkInjection(scriptState, IDBKey::createArray(IDBKey::KeyArray()), scriptO
bject, "foo.baz"); |
170 checkInjection(scriptState, IDBKey::createArray(IDBKey::KeyArray()), scriptO
bject, "bar"); | 170 checkInjection(scriptState, IDBKey::createArray(IDBKey::KeyArray()), scriptO
bject, "bar"); |
171 | 171 |
172 checkInjectionFails(scriptState, IDBKey::createString("zoo"), scriptObject,
"foo.bar.baz"); | 172 checkInjectionFails(scriptState, IDBKey::createString("zoo"), scriptObject,
"foo.bar.baz"); |
173 checkInjection(scriptState, IDBKey::createString("zoo"), scriptObject, "foo.
xyz.foo"); | 173 checkInjection(scriptState, IDBKey::createString("zoo"), scriptObject, "foo.
xyz.foo"); |
174 } | 174 } |
175 | 175 |
176 } // namespace | 176 } // namespace |
OLD | NEW |