| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "bindings/core/v8/SerializedScriptValue.h" | 5 #include "bindings/core/v8/SerializedScriptValue.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 8 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 8 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/core/v8/V8BindingForTesting.h" | 10 #include "bindings/core/v8/V8BindingForTesting.h" |
| 11 #include "bindings/core/v8/V8File.h" | 11 #include "bindings/core/v8/V8File.h" |
| 12 #include "core/fileapi/File.h" | 12 #include "core/fileapi/File.h" |
| 13 #include "platform/testing/UnitTestHelpers.h" | 13 #include "platform/testing/UnitTestHelpers.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 class SerializedScriptValueTest : public ::testing::Test { | 18 class SerializedScriptValueTest : public ::testing::Test { |
| 19 public: | 19 public: |
| 20 SerializedScriptValueTest() | 20 SerializedScriptValueTest() |
| 21 : m_scope(v8::Isolate::GetCurrent()) | 21 : m_scope(v8::Isolate::GetCurrent()) |
| 22 { | 22 { |
| 23 } | 23 } |
| 24 | 24 |
| 25 v8::Isolate* isolate() const { return m_scope.isolate(); } | 25 v8::Isolate* isolate() const { return m_scope.isolate(); } |
| 26 v8::Local<v8::Object> creationContext() const { return m_scope.scriptState()
->context()->Global(); } | 26 v8::Local<v8::Object> creationContext() const { return m_scope.getScriptStat
e()->context()->Global(); } |
| 27 | 27 |
| 28 protected: | 28 protected: |
| 29 V8TestingScope m_scope; | 29 V8TestingScope m_scope; |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 TEST_F(SerializedScriptValueTest, UserSelectedFile) | 32 TEST_F(SerializedScriptValueTest, UserSelectedFile) |
| 33 { | 33 { |
| 34 String filePath = testing::blinkRootDir(); | 34 String filePath = testing::blinkRootDir(); |
| 35 filePath.append("/Source/bindings/core/v8/SerializedScriptValueTest.cpp"); | 35 filePath.append("/Source/bindings/core/v8/SerializedScriptValueTest.cpp"); |
| 36 File* originalFile = File::create(filePath); | 36 File* originalFile = File::create(filePath); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 64 v8::Local<v8::Value> v8File = serializedScriptValue->deserialize(isolate()); | 64 v8::Local<v8::Value> v8File = serializedScriptValue->deserialize(isolate()); |
| 65 | 65 |
| 66 ASSERT_TRUE(V8File::hasInstance(v8File, isolate())); | 66 ASSERT_TRUE(V8File::hasInstance(v8File, isolate())); |
| 67 File* file = V8File::toImpl(v8::Local<v8::Object>::Cast(v8File)); | 67 File* file = V8File::toImpl(v8::Local<v8::Object>::Cast(v8File)); |
| 68 EXPECT_FALSE(file->hasBackingFile()); | 68 EXPECT_FALSE(file->hasBackingFile()); |
| 69 EXPECT_EQ(File::IsNotUserVisible, file->getUserVisibility()); | 69 EXPECT_EQ(File::IsNotUserVisible, file->getUserVisibility()); |
| 70 EXPECT_EQ("hello.txt", file->name()); | 70 EXPECT_EQ("hello.txt", file->name()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |