diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 05:00:45 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 05:00:45 +0000 |
commit | 3afb9d38ba9ea2fd44fe44a026fdec1396188637 (patch) | |
tree | d96d28140c7f2227eac2cae0ff0027504bcbf958 | |
parent | b504899244b4264994d4daae2bee660706dba652 (diff) | |
download | chromium_src-3afb9d38ba9ea2fd44fe44a026fdec1396188637.zip chromium_src-3afb9d38ba9ea2fd44fe44a026fdec1396188637.tar.gz chromium_src-3afb9d38ba9ea2fd44fe44a026fdec1396188637.tar.bz2 |
Don't assume WebCore::UChar is equivalent to wchar_t, and don't assume '\\' is a valid file path separator.
Review URL: http://codereview.chromium.org/9489
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4972 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/dom_serializer.cc | 4 | ||||
-rw-r--r-- | webkit/glue/dom_serializer_unittest.cc | 11 | ||||
-rw-r--r-- | webkit/tools/test_shell/SConscript | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/webkit/glue/dom_serializer.cc b/webkit/glue/dom_serializer.cc index dd415a5..ca2c775 100644 --- a/webkit/glue/dom_serializer.cc +++ b/webkit/glue/dom_serializer.cc @@ -227,8 +227,8 @@ WebCore::String DomSerializer::PreActionBeforeSerializeOpenTag( xml_encoding = WebCore::UTF8Encoding().name(); std::wstring str_xml_declaration = StringPrintf(kXMLDeclaration, - param->doc->xmlVersion().charactersWithNullTermination(), - xml_encoding.charactersWithNullTermination(), + StringToStdWString(param->doc->xmlVersion()).c_str(), + StringToStdWString(xml_encoding).c_str(), param->doc->xmlStandalone() ? L" standalone=\"yes\"" : L""); result += StdWStringToString(str_xml_declaration); diff --git a/webkit/glue/dom_serializer_unittest.cc b/webkit/glue/dom_serializer_unittest.cc index 99d0fdc..b5df8e2 100644 --- a/webkit/glue/dom_serializer_unittest.cc +++ b/webkit/glue/dom_serializer_unittest.cc @@ -573,7 +573,8 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithBaseTag) { // There are total 2 available base tags in this test file. const int kTotalBaseTagCountInTestFile = 2; std::wstring page_file_path = data_dir_; - file_util::AppendToPath(&page_file_path, L"dom_serializer\\"); + file_util::AppendToPath(&page_file_path, L"dom_serializer"); + page_file_path.append(1, file_util::kPathSeparator); // Get page dir URL which is base URL of this file. GURL path_dir_url = net::FilePathToFileURL(page_file_path); // Get file path. @@ -619,12 +620,12 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithBaseTag) { } } } - ASSERT_TRUE(original_base_tag_count == kTotalBaseTagCountInTestFile); + ASSERT_EQ(original_base_tag_count, kTotalBaseTagCountInTestFile); // Make sure in original document, the base URL is not equal with the // |path_dir_url|. GURL original_base_url( WideToUTF8(webkit_glue::StringToStdWString(doc->baseURL()))); - ASSERT_TRUE(original_base_url != path_dir_url); + ASSERT_NE(original_base_url, path_dir_url); // Do serialization. SerializeDomForURL(page_url, false); @@ -671,9 +672,9 @@ TEST_F(DomSerializerTests, SerialzeHTMLDOMWithBaseTag) { } } // We have one more added BASE tag which is generated by JavaScript. - ASSERT_TRUE(new_base_tag_count == original_base_tag_count + 1); + ASSERT_EQ(new_base_tag_count, original_base_tag_count + 1); // Make sure in new document, the base URL is equal with the |path_dir_url|. GURL new_base_url( WideToUTF8(webkit_glue::StringToStdWString(doc->baseURL()))); - ASSERT_TRUE(new_base_url == path_dir_url); + ASSERT_EQ(new_base_url, path_dir_url); } diff --git a/webkit/tools/test_shell/SConscript b/webkit/tools/test_shell/SConscript index cbee0f7..4182d4e 100644 --- a/webkit/tools/test_shell/SConscript +++ b/webkit/tools/test_shell/SConscript @@ -164,6 +164,7 @@ test_files = [ '$WEBKIT_DIR/glue/cpp_bound_class_unittest.cc', '$WEBKIT_DIR/glue/cpp_variant_unittest.cc', '$WEBKIT_DIR/glue/dom_operations_unittest.cc', + '$WEBKIT_DIR/glue/dom_serializer_unittest.cc', '$WEBKIT_DIR/glue/glue_serialize_unittest.cc', '$WEBKIT_DIR/glue/iframe_redirect_unittest.cc', '$WEBKIT_DIR/glue/multipart_response_delegate_unittest.cc', @@ -180,7 +181,6 @@ if env['PLATFORM'] == 'win32': 'plugin_tests.cc', 'text_input_controller_unittest.cc', '$WEBKIT_DIR/glue/context_menu_unittest.cc', - '$WEBKIT_DIR/glue/dom_serializer_unittest.cc', '$WEBKIT_DIR/glue/mimetype_unittest.cc', '$WEBKIT_DIR/glue/resource_fetcher_unittest.cc', # Commented out until a regression is fixed and this file is restored. |