summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/util
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 02:22:16 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 02:22:16 +0000
commita78410304ccc90a44852c9714317787c63bb50a3 (patch)
tree61ea6fdbfe008cfadd5ad4a251638baa45e583d5 /chrome/browser/sync/util
parentc8ca48ea1bfeaa037fd7dc3183b9ceddec061afd (diff)
downloadchromium_src-a78410304ccc90a44852c9714317787c63bb50a3.zip
chromium_src-a78410304ccc90a44852c9714317787c63bb50a3.tar.gz
chromium_src-a78410304ccc90a44852c9714317787c63bb50a3.tar.bz2
Made sync code build and pass unit tests on OS X.
Major changes: - Moved sync_setup_{flow,wizard} to sync directory. - Made browser_with_test_window_test compile on non-Windows platform. - Moved localized contents font util functions to app/. BUG=23073 TEST=trybot Review URL: http://codereview.chromium.org/279004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29239 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/util')
-rw-r--r--chrome/browser/sync/util/character_set_converters.h15
-rw-r--r--chrome/browser/sync/util/user_settings_unittest.cc12
2 files changed, 20 insertions, 7 deletions
diff --git a/chrome/browser/sync/util/character_set_converters.h b/chrome/browser/sync/util/character_set_converters.h
index 1db32c7..6a833ee 100644
--- a/chrome/browser/sync/util/character_set_converters.h
+++ b/chrome/browser/sync/util/character_set_converters.h
@@ -136,6 +136,21 @@ inline void AppendPathStringToUTF8(const PathString& wide,
return AppendPathStringToUTF8(wide.data(), wide.length(), output_string);
}
+// Versions of UTF8ToPathString/PathStringToUTF8 that return the converted
+// string directly. Any errors encountered will CHECK(). These functions are
+// intended to be used only for testing.
+
+inline PathString UTF8ToPathStringQuick(const std::string &utf8) {
+ PathString wide;
+ CHECK(UTF8ToPathString(utf8.data(), utf8.size(), &wide));
+ return wide;
+}
+
+inline std::string PathStringToUTF8Quick(const PathString& wide) {
+ std::string utf8;
+ PathStringToUTF8(wide.data(), wide.size(), &utf8);
+ return utf8;
+}
inline bool Append(const PathChar* wide, int size,
std::string* output_string) {
diff --git a/chrome/browser/sync/util/user_settings_unittest.cc b/chrome/browser/sync/util/user_settings_unittest.cc
index 952c86b..02f3fd8 100644
--- a/chrome/browser/sync/util/user_settings_unittest.cc
+++ b/chrome/browser/sync/util/user_settings_unittest.cc
@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE entry.
+#include <string>
+
#include "base/file_util.h"
#include "base/test/test_file_util.h"
#include "chrome/browser/sync/syncable/directory_manager.h"
+#include "chrome/browser/sync/util/character_set_converters.h"
#include "chrome/browser/sync/util/user_settings.h"
#include "chrome/browser/sync/util/query_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -40,15 +43,10 @@ class UserSettingsTest : public testing::Test {
ExecOrDie(primer_handle, "CREATE TABLE shares"
" (email, share_name, file_name,"
" PRIMARY KEY(email, share_name) ON CONFLICT REPLACE)");
-#if OS_WIN
- // Populate a share.
- ExecOrDie(primer_handle, "INSERT INTO shares values ( ?, ?, ?)",
- "foo@foo.com", "foo@foo.com", WideToUTF8(kOldStyleSyncDataDB));
-#elif OS_LINUX
// Populate a share.
ExecOrDie(primer_handle, "INSERT INTO shares values ( ?, ?, ?)",
- "foo@foo.com", "foo@foo.com", kOldStyleSyncDataDB);
-#endif
+ "foo@foo.com", "foo@foo.com",
+ browser_sync::PathStringToUTF8Quick(kOldStyleSyncDataDB));
sqlite3_close(primer_handle);
}