| 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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "chrome/test/base/in_process_browser_test.h" | 6 #include "chrome/test/base/in_process_browser_test.h" |
| 7 #include "chrome/test/base/ui_test_utils.h" | 7 #include "chrome/test/base/ui_test_utils.h" |
| 8 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 8 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 9 #include "content/browser/utility_process_host.h" | 9 #include "content/browser/utility_process_host.h" |
| 10 #include "content/common/content_webkitplatformsupport_impl.h" |
| 10 #include "content/common/indexed_db_key.h" | 11 #include "content/common/indexed_db_key.h" |
| 11 #include "content/common/utility_messages.h" | 12 #include "content/common/utility_messages.h" |
| 12 #include "content/public/common/serialized_script_value.h" | 13 #include "content/public/common/serialized_script_value.h" |
| 13 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa
lue.h" |
| 17 #include "webkit/glue/idb_bindings.h" | 18 #include "webkit/glue/idb_bindings.h" |
| 18 #include "webkit/glue/web_io_operators.h" | 19 #include "webkit/glue/web_io_operators.h" |
| 19 #include "webkit/glue/webkitplatformsupport_impl.h" | |
| 20 | 20 |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 using WebKit::WebSerializedScriptValue; | 22 using WebKit::WebSerializedScriptValue; |
| 23 | 23 |
| 24 // Enables calling WebKit::shutdown no matter where a "return" happens. | 24 // Enables calling WebKit::shutdown no matter where a "return" happens. |
| 25 class ScopedShutdownWebKit { | 25 class ScopedShutdownWebKit { |
| 26 public: | 26 public: |
| 27 ScopedShutdownWebKit() { | 27 ScopedShutdownWebKit() { |
| 28 } | 28 } |
| 29 | 29 |
| 30 ~ScopedShutdownWebKit() { | 30 ~ScopedShutdownWebKit() { |
| 31 WebKit::shutdown(); | 31 WebKit::shutdown(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 DISALLOW_COPY_AND_ASSIGN(ScopedShutdownWebKit); | 35 DISALLOW_COPY_AND_ASSIGN(ScopedShutdownWebKit); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // Sanity test, check the function call directly outside the sandbox. | 38 // Sanity test, check the function call directly outside the sandbox. |
| 39 TEST(IDBKeyPathWithoutSandbox, Value) { | 39 TEST(IDBKeyPathWithoutSandbox, Value) { |
| 40 webkit_glue::WebKitPlatformSupportImpl webkit_platform_support; | 40 content::WebKitPlatformSupportImpl webkit_platform_support; |
| 41 WebKit::initialize(&webkit_platform_support); | 41 WebKit::initialize(&webkit_platform_support); |
| 42 ScopedShutdownWebKit shutdown_webkit; | 42 ScopedShutdownWebKit shutdown_webkit; |
| 43 | 43 |
| 44 char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; | 44 char16 data[] = {0x0353,0x6f66,0x536f,0x7a03,0x6f6f,0x017b}; |
| 45 std::vector<WebSerializedScriptValue> serialized_values; | 45 std::vector<WebSerializedScriptValue> serialized_values; |
| 46 serialized_values.push_back( | 46 serialized_values.push_back( |
| 47 WebSerializedScriptValue::fromString(string16(data, arraysize(data)))); | 47 WebSerializedScriptValue::fromString(string16(data, arraysize(data)))); |
| 48 serialized_values.push_back( | 48 serialized_values.push_back( |
| 49 WebSerializedScriptValue::fromString(string16())); | 49 WebSerializedScriptValue::fromString(string16())); |
| 50 | 50 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 ScopedIDBKeyPathHelper scoped_helper; | 361 ScopedIDBKeyPathHelper scoped_helper; |
| 362 scoped_helper.SetExpectedValue(expected_value); | 362 scoped_helper.SetExpectedValue(expected_value); |
| 363 // TODO(lukezarko@gmail.com): re-enable this after the changes described at | 363 // TODO(lukezarko@gmail.com): re-enable this after the changes described at |
| 364 // https://bugs.webkit.org/show_bug.cgi?id=63481 land. | 364 // https://bugs.webkit.org/show_bug.cgi?id=63481 land. |
| 365 // scoped_helper.CheckInjectValue(key, value, UTF8ToUTF16("bar")); | 365 // scoped_helper.CheckInjectValue(key, value, UTF8ToUTF16("bar")); |
| 366 | 366 |
| 367 // Expect null. | 367 // Expect null. |
| 368 scoped_helper.SetExpectedValue(content::SerializedScriptValue()); | 368 scoped_helper.SetExpectedValue(content::SerializedScriptValue()); |
| 369 scoped_helper.CheckInjectValue(key, value, UTF8ToUTF16("bad.key.path")); | 369 scoped_helper.CheckInjectValue(key, value, UTF8ToUTF16("bad.key.path")); |
| 370 } | 370 } |
| OLD | NEW |