Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Unified Diff: webkit/database/database_util_unittest.cc

Issue 12327022: Merge 183141 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/database/database_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/database/database_util_unittest.cc
===================================================================
--- webkit/database/database_util_unittest.cc (revision 183642)
+++ webkit/database/database_util_unittest.cc (working copy)
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/string_piece.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/database/database_util.h"
@@ -31,6 +32,12 @@
return DatabaseUtil::GetOriginFromIdentifier(id);
}
+static void TestValidOriginIdentifier(bool expected_result,
+ const base::StringPiece id) {
+ EXPECT_EQ(expected_result,
+ DatabaseUtil::IsValidOriginIdentifier(ASCIIToUTF16(id)));
+}
+
namespace webkit_database {
// Test DatabaseUtil::CrackVfsFilePath on various inputs.
@@ -54,4 +61,13 @@
EXPECT_EQ(kHttpOrigin, ToAndFromOriginIdentifier(kHttpOrigin));
}
+TEST(DatabaseUtilTest, IsValidOriginIdentifier) {
+ TestValidOriginIdentifier(true, "http_bar_0");
+ TestValidOriginIdentifier(true, "");
+ TestValidOriginIdentifier(false, "bad..id");
+ TestValidOriginIdentifier(false, "bad/id");
+ TestValidOriginIdentifier(false, "bad\\id");
+ TestValidOriginIdentifier(false, base::StringPiece("bad\0id", 6));
+}
+
} // namespace webkit_database
« no previous file with comments | « webkit/database/database_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698