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