summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/util
diff options
context:
space:
mode:
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/event_sys_unittest.cc4
-rw-r--r--chrome/browser/sync/util/user_settings_unittest.cc12
3 files changed, 22 insertions, 9 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/event_sys_unittest.cc b/chrome/browser/sync/util/event_sys_unittest.cc
index 814ed46..c39ea9a 100644
--- a/chrome/browser/sync/util/event_sys_unittest.cc
+++ b/chrome/browser/sync/util/event_sys_unittest.cc
@@ -87,8 +87,8 @@ class EventLogger {
}
void HandlePairEvent(const string& name, const TestEvent& event) {
- const char* what_changed;
- int new_value;
+ const char* what_changed = NULL;
+ int new_value = 0;
Hookups::iterator dead;
switch (event.what_happened) {
case TestEvent::A_CHANGED:
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);
}