summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 21:15:33 +0000
committermunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 21:15:33 +0000
commit7fd41a837aef6af92487dccfcc2819e3de8c6e41 (patch)
treee5e9cd67fd3b3b828002cc345a2632b4e00688d0 /chrome
parentd37e8c5be9976f051c50529eb39a29d56cfd0dc1 (diff)
downloadchromium_src-7fd41a837aef6af92487dccfcc2819e3de8c6e41.zip
chromium_src-7fd41a837aef6af92487dccfcc2819e3de8c6e41.tar.gz
chromium_src-7fd41a837aef6af92487dccfcc2819e3de8c6e41.tar.bz2
Part 2 of string cleanup in Sync:
- Get rid of sync_char16 from syncapi - Use wstring for title in syncapi since that gets converted to wstring later on anyway. - Use GURL for urls in syncapi - Return const string references from syncapi instead of pointers to C-style strings. - Make appropriate changes to calling code. BUG=26342 TEST=Already exist. Review URL: http://codereview.chromium.org/362019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/engine/syncapi.cc109
-rw-r--r--chrome/browser/sync/engine/syncapi.h44
-rw-r--r--chrome/browser/sync/glue/change_processor.cc16
-rw-r--r--chrome/browser/sync/glue/model_associator.cc39
-rw-r--r--chrome/browser/sync/glue/model_associator.h5
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.h2
-rw-r--r--chrome/browser/sync/profile_sync_service_unittest.cc75
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc3
-rw-r--r--chrome/test/live_sync/bookmark_model_verifier.cc27
-rw-r--r--chrome/test/live_sync/bookmark_model_verifier.h8
-rw-r--r--chrome/test/live_sync/live_bookmarks_sync_test.cc9
-rw-r--r--chrome/test/live_sync/live_bookmarks_sync_test.h2
-rw-r--r--chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc539
13 files changed, 386 insertions, 492 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index 7cf18bc..b220751 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -22,6 +22,7 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/task.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/sync/engine/all_status.h"
#include "chrome/browser/sync/engine/auth_watcher.h"
#include "chrome/browser/sync/engine/change_reorder_buffer.h"
@@ -43,7 +44,6 @@
#include "chrome/browser/sync/util/event_sys.h"
#include "chrome/browser/sync/util/path_helpers.h"
#include "chrome/browser/sync/util/user_settings.h"
-#include "googleurl/src/gurl.h"
#if defined(OS_WIN)
#pragma comment(lib, "iphlpapi.lib")
@@ -138,8 +138,7 @@ static const FilePath::CharType kBookmarkSyncUserSettingsDatabase[] =
static const PSTR_CHAR kDefaultNameForNewNodes[] = PSTR(" ");
// The list of names which are reserved for use by the server.
-static const char16* kForbiddenServerNames[] =
- { STRING16(""), STRING16("."), STRING16("..") };
+static const char* kForbiddenServerNames[] = { "", ".", ".." };
//////////////////////////////////////////////////////////////////////////
// Static helper functions.
@@ -158,7 +157,7 @@ static int64 IdToMetahandle(syncable::BaseTransaction* trans,
// characters. The three server-illegal names are the empty string, dot, and
// dot-dot. Very long names (>255 bytes in UTF-8 Normalization Form C) are
// also illegal, but are not considered here.
-static bool IsNameServerIllegalAfterTrimming(const string16& name) {
+static bool IsNameServerIllegalAfterTrimming(const std::string& name) {
size_t untrimmed_count = name.find_last_not_of(' ') + 1;
for (size_t i = 0; i < arraysize(kForbiddenServerNames); ++i) {
if (name.compare(0, untrimmed_count, kForbiddenServerNames[i]) == 0)
@@ -167,31 +166,31 @@ static bool IsNameServerIllegalAfterTrimming(const string16& name) {
return false;
}
-static bool EndsWithSpace(const string16& string) {
+static bool EndsWithSpace(const std::string& string) {
return !string.empty() && *string.rbegin() == ' ';
}
// When taking a name from the syncapi, append a space if it matches the
// pattern of a server-illegal name followed by zero or more spaces.
-static void SyncAPINameToServerName(const sync_char16 *sync_api_name,
- PathString* out) {
- *out = UTF16ToUTF8(sync_api_name);
- string16 sync_api_name_str(sync_api_name);
- if (IsNameServerIllegalAfterTrimming(sync_api_name_str))
- out->append(PSTR(" "));
+static void SyncAPINameToServerName(const std::wstring& sync_api_name,
+ std::string* out) {
+ *out = WideToUTF8(sync_api_name);
+ if (IsNameServerIllegalAfterTrimming(*out))
+ out->append(" ");
}
// In the reverse direction, if a server name matches the pattern of a
// server-illegal name followed by one or more spaces, remove the trailing
// space.
-static void ServerNameToSyncAPIName(const PathString& server_name,
- string16*out) {
- string16 server_name_str(UTF8ToUTF16(server_name));
- if (IsNameServerIllegalAfterTrimming(server_name_str) &&
- EndsWithSpace(server_name_str))
- out->assign(server_name_str, 0, server_name_str.size() - 1);
- else
- out->assign(server_name_str);
+static void ServerNameToSyncAPIName(const std::string& server_name,
+ std::wstring* out) {
+ int length_to_copy = server_name.length();
+ if (IsNameServerIllegalAfterTrimming(server_name) &&
+ EndsWithSpace(server_name))
+ --length_to_copy;
+ if (!UTF8ToWide(server_name.c_str(), length_to_copy, out)) {
+ NOTREACHED() << "Could not convert server name from UTF8 to wide";
+ }
}
// A UserShare encapsulates the syncable pieces that represent an authenticated
@@ -208,9 +207,7 @@ struct UserShare {
// on first-run it is empty until an AUTH_SUCCEEDED event and on future runs
// it is set as soon as the client instructs us to authenticate for the last
// known valid user (AuthenticateForLastKnownUser()).
- // Stored as a PathString to avoid string conversions each time a transaction
- // is created.
- PathString authenticated_name;
+ std::string authenticated_name;
};
////////////////////////////////////
@@ -219,8 +216,8 @@ struct UserShare {
// BaseNode::BaseNodeInternal provides storage for member Get() functions that
// need to return pointers (e.g. strings).
struct BaseNode::BaseNodeInternal {
- string16 url;
- string16 title;
+ GURL url;
+ std::wstring title;
Directory::ChildHandles child_handles;
syncable::Blob favicon;
};
@@ -244,17 +241,16 @@ bool BaseNode::GetIsFolder() const {
return GetEntry()->Get(syncable::IS_DIR);
}
-const sync_char16* BaseNode::GetTitle() const {
- // Store the string in data_ so that the returned pointer is valid.
+const std::wstring& BaseNode::GetTitle() const {
ServerNameToSyncAPIName(GetEntry()->GetName().non_unique_value(),
&data_->title);
- return data_->title.c_str();
+ return data_->title;
}
-const sync_char16* BaseNode::GetURL() const {
- // Store the string in data_ so that the returned pointer is valid.
- data_->url = UTF8ToUTF16(GetEntry()->Get(syncable::BOOKMARK_URL));
- return data_->url.c_str();
+const GURL& BaseNode::GetURL() const {
+ GURL url(GetEntry()->Get(syncable::BOOKMARK_URL));
+ url.Swap(&data_->url);
+ return data_->url;
}
const int64* BaseNode::GetChildIds(size_t* child_count) const {
@@ -314,8 +310,8 @@ void WriteNode::SetIsFolder(bool folder) {
MarkForSyncing();
}
-void WriteNode::SetTitle(const sync_char16* title) {
- PathString server_legal_name;
+void WriteNode::SetTitle(const std::wstring& title) {
+ std::string server_legal_name;
SyncAPINameToServerName(title, &server_legal_name);
syncable::Name old_name = entry_->GetName();
@@ -337,8 +333,8 @@ void WriteNode::SetTitle(const sync_char16* title) {
MarkForSyncing();
}
-void WriteNode::SetURL(const sync_char16* url) {
- PathString url_string(UTF16ToUTF8(url));
+void WriteNode::SetURL(const GURL& url) {
+ const std::string& url_string = url.spec();
if (url_string == entry_->Get(syncable::BOOKMARK_URL))
return; // Skip redundant changes.
@@ -521,13 +517,12 @@ const BaseTransaction* ReadNode::GetTransaction() const {
return transaction_;
}
-bool ReadNode::InitByTagLookup(const sync_char16* tag) {
+bool ReadNode::InitByTagLookup(const std::string& tag) {
DCHECK(!entry_) << "Init called twice";
- PathString tag_string(UTF16ToUTF8(tag));
- if (tag_string.empty())
+ if (tag.empty())
return false;
syncable::BaseTransaction* trans = transaction_->GetWrappedTrans();
- entry_ = new syncable::Entry(trans, syncable::GET_BY_TAG, tag_string);
+ entry_ = new syncable::Entry(trans, syncable::GET_BY_TAG, tag);
if (!entry_->good())
return false;
if (entry_->Get(syncable::IS_DEL))
@@ -745,16 +740,12 @@ class SyncManager::SyncInternal {
void set_observer(Observer* observer) { observer_ = observer; }
UserShare* GetUserShare() { return &share_; }
- // Return the currently active (validated) username as a PathString for
- // use with syncable types.
- const PathString& username_for_share() const {
+ // Return the currently active (validated) username for use with syncable
+ // types.
+ const std::string& username_for_share() const {
return share_.authenticated_name;
}
- // Returns the authenticated username from our AuthWatcher in UTF8.
- // See SyncManager::GetAuthenticatedUsername for details.
- const char* GetAuthenticatedUsername();
-
// Note about SyncManager::Status implementation: Status is a trimmed
// down AllStatus::Status, augmented with authentication failure information
// gathered from the internal AuthWatcher. The sync UI itself hooks up to
@@ -767,7 +758,7 @@ class SyncManager::SyncInternal {
Status::Summary ComputeAggregatedStatusSummary();
// See SyncManager::SetupForTestMode for information.
- void SetupForTestMode(const sync_char16* test_username);
+ void SetupForTestMode(const std::wstring& test_username);
// See SyncManager::Shutdown for information.
void Shutdown();
@@ -839,12 +830,6 @@ class SyncManager::SyncInternal {
// constructing any transaction type.
UserShare share_;
- // A cached string for callers of GetAuthenticatedUsername. We just store the
- // last result of auth_watcher_->email() here and change it on future calls,
- // because callers of GetAuthenticatedUsername are supposed to copy the value
- // if they need it for longer than the scope of the call.
- std::string cached_auth_watcher_email_;
-
// A wrapper around a sqlite store used for caching authentication data,
// last user information, current sync-related URLs, and more.
scoped_ptr<UserSettings> user_settings_;
@@ -951,15 +936,9 @@ void SyncManager::Authenticate(const char* username, const char* password) {
data_->Authenticate(std::string(username), std::string(password));
}
-const char* SyncManager::GetAuthenticatedUsername() {
- if (!data_)
- return NULL;
- return data_->GetAuthenticatedUsername();
-}
-
-const char* SyncManager::SyncInternal::GetAuthenticatedUsername() {
- cached_auth_watcher_email_ = username_for_share();
- return cached_auth_watcher_email_.c_str();
+const std::string& SyncManager::GetAuthenticatedUsername() {
+ DCHECK(data_);
+ return data_->username_for_share();
}
bool SyncManager::SyncInternal::Init(
@@ -1493,14 +1472,14 @@ void SyncManager::SyncInternal::SaveChanges() {
lookup->SaveChanges();
}
-void SyncManager::SetupForTestMode(const sync_char16* test_username) {
+void SyncManager::SetupForTestMode(const std::wstring& test_username) {
DCHECK(data_) << "SetupForTestMode requires initialization";
data_->SetupForTestMode(test_username);
}
void SyncManager::SyncInternal::SetupForTestMode(
- const sync_char16* test_username) {
- share_.authenticated_name = UTF16ToUTF8(test_username);
+ const std::wstring& test_username) {
+ share_.authenticated_name = WideToUTF8(test_username);
if (!dir_manager()->Open(username_for_share()))
DCHECK(false) << "Could not open directory when running in test mode";
diff --git a/chrome/browser/sync/engine/syncapi.h b/chrome/browser/sync/engine/syncapi.h
index f85b25b..96f7815 100644
--- a/chrome/browser/sync/engine/syncapi.h
+++ b/chrome/browser/sync/engine/syncapi.h
@@ -38,15 +38,12 @@
#ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_
#define CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_
+#include <string>
+
#include "base/basictypes.h"
#include "base/file_path.h"
#include "build/build_config.h"
-
-#if defined(OS_WIN)
-typedef wchar_t sync_char16;
-#else
-typedef uint16 sync_char16;
-#endif
+#include "googleurl/src/gurl.h"
// The MSVC compiler for Windows requires that any classes exported by, or
// imported from, a dynamic library be marked with an appropriate
@@ -106,19 +103,13 @@ class SYNC_EXPORT BaseNode {
// of syncable::Entry.
bool GetIsFolder() const;
- // Returns the title of the object as a C string. The memory is owned by
- // BaseNode and becomes invalid if GetTitle() is called a second time on this
- // node, or when the node is destroyed. A caller should convert this
- // immediately into e.g. a std::string. Uniqueness of the title is not
- // enforced on siblings -- it is not an error for two children to share
- // a title.
- const sync_char16* GetTitle() const;
+ // Returns the title of the object.
+ // Uniqueness of the title is not enforced on siblings -- it is not an error
+ // for two children to share a title.
+ const std::wstring& GetTitle() const;
- // Returns the URL of a bookmark object as a C string. The memory is owned
- // by BaseNode and becomes invalid if GetURL() is called a second time on
- // this node, or when the node is destroyed. A caller should convert this
- // immediately into e.g. a std::string.
- const sync_char16* GetURL() const;
+ // Returns the URL of a bookmark object.
+ const GURL& GetURL() const;
// Return a pointer to the byte data of the favicon image for this node.
// Will return NULL if there is no favicon data associated with this node.
@@ -192,8 +183,8 @@ class SYNC_EXPORT WriteNode : public BaseNode {
// These Set() functions correspond to the Get() functions of BaseNode.
void SetIsFolder(bool folder);
- void SetTitle(const sync_char16* title);
- void SetURL(const sync_char16* url);
+ void SetTitle(const std::wstring& title);
+ void SetURL(const GURL& url);
void SetFaviconBytes(const unsigned char* bytes, size_t size_in_bytes);
// External ID is a client-only field, so setting it doesn't cause the item to
// be synced again.
@@ -253,8 +244,8 @@ class SYNC_EXPORT ReadNode : public BaseNode {
// Each server-created permanent node is tagged with a unique string.
// Look up the node with the particular tag. If it does not exist,
// return false. Since these nodes are special, lookup is only
- // provided only through ReadNode.
- bool InitByTagLookup(const sync_char16* tag);
+ // provided through ReadNode.
+ bool InitByTagLookup(const std::string& tag);
// Implementation of BaseNode's abstract virtual accessors.
virtual const syncable::Entry* GetEntry() const;
@@ -536,10 +527,9 @@ class SYNC_EXPORT SyncManager {
bool attempt_last_user_authentication,
const char* user_agent);
- // Returns the username last used for a successful authentication as a
- // null-terminated string. Returns empty if there is no such username.
- // The memory is not owned by the caller and should be copied.
- const char* GetAuthenticatedUsername();
+ // Returns the username last used for a successful authentication.
+ // Returns empty if there is no such username.
+ const std::string& GetAuthenticatedUsername();
// Submit credentials to GAIA for verification and start the
// syncing process on success. On success, both |username| and the obtained
@@ -580,7 +570,7 @@ class SYNC_EXPORT SyncManager {
// communication will take place).
// Note: The SyncManager precondition that you must first call Init holds;
// this will fail unless we're initialized.
- void SetupForTestMode(const sync_char16* test_username);
+ void SetupForTestMode(const std::wstring& test_username);
// Issue a final SaveChanges, close sqlite handles, and stop running threads.
// Must be called from the same thread that called Init().
diff --git a/chrome/browser/sync/glue/change_processor.cc b/chrome/browser/sync/glue/change_processor.cc
index 5bf0e1a..89ec4306 100644
--- a/chrome/browser/sync/glue/change_processor.cc
+++ b/chrome/browser/sync/glue/change_processor.cc
@@ -40,11 +40,8 @@ void ChangeProcessor::UpdateSyncNodeProperties(const BookmarkNode* src,
sync_api::WriteNode* dst) {
// Set the properties of the item.
dst->SetIsFolder(src->is_folder());
- dst->SetTitle(WideToUTF16(src->GetTitle()).c_str());
- // URL is passed as a C string here because this interface avoids
- // string16. SetURL copies the data into its own memory.
- string16 url = UTF8ToUTF16(src->GetURL().spec());
- dst->SetURL(url.c_str());
+ dst->SetTitle(src->GetTitle());
+ dst->SetURL(src->GetURL());
SetSyncNodeFavicon(src, model, dst);
}
@@ -461,8 +458,8 @@ const BookmarkNode* ChangeProcessor::CreateOrUpdateBookmarkNode(
const BookmarkNode* old_dst = dst;
dst = bookmark_utils::ApplyEditsWithNoGroupChange(model, parent,
BookmarkEditor::EditDetails(dst),
- UTF16ToWide(src->GetTitle()),
- src->GetIsFolder() ? GURL() : GURL(src->GetURL()),
+ src->GetTitle(),
+ src->GetIsFolder() ? GURL() : src->GetURL(),
NULL); // NULL because we don't need a BookmarkEditor::Handler.
if (dst != old_dst) { // dst was replaced with a new node with new URL.
model_associator_->DisassociateIds(src->GetId());
@@ -487,11 +484,10 @@ const BookmarkNode* ChangeProcessor::CreateBookmarkNode(
const BookmarkNode* node;
if (sync_node->GetIsFolder()) {
- node = model->AddGroup(parent, index, UTF16ToWide(sync_node->GetTitle()));
+ node = model->AddGroup(parent, index, sync_node->GetTitle());
} else {
- GURL url(sync_node->GetURL());
node = model->AddURL(parent, index,
- UTF16ToWide(sync_node->GetTitle()), url);
+ sync_node->GetTitle(), sync_node->GetURL());
SetBookmarkFavicon(sync_node, node, model->profile());
}
return node;
diff --git a/chrome/browser/sync/glue/model_associator.cc b/chrome/browser/sync/glue/model_associator.cc
index 74eaa91..a936d552 100644
--- a/chrome/browser/sync/glue/model_associator.cc
+++ b/chrome/browser/sync/glue/model_associator.cc
@@ -33,8 +33,8 @@ namespace browser_sync {
//
// TODO(ncarter): Pull these tags from an external protocol specification
// rather than hardcoding them here.
-static const wchar_t* kOtherBookmarksTag = L"other_bookmarks";
-static const wchar_t* kBookmarkBarTag = L"bookmark_bar";
+static const char kBookmarkBarTag[] = "bookmark_bar";
+static const char kOtherBookmarksTag[] = "other_bookmarks";
// Bookmark comparer for map of bookmark nodes.
class BookmarkComparer {
@@ -54,11 +54,7 @@ class BookmarkComparer {
if (result != 0)
return result < 0;
- result = node1->GetURL().spec().compare(node2->GetURL().spec());
- if (result != 0)
- return result < 0;
-
- return false;
+ return node1->GetURL() < node2->GetURL();
}
};
@@ -93,8 +89,8 @@ BookmarkNodeFinder::BookmarkNodeFinder(const BookmarkNode* parent_node)
const BookmarkNode* BookmarkNodeFinder::FindBookmarkNode(
const sync_api::BaseNode& sync_node) {
// Create a bookmark node from the given sync node.
- BookmarkNode temp_node(GURL(sync_node.GetURL()));
- temp_node.SetTitle(UTF16ToWide(sync_node.GetTitle()));
+ BookmarkNode temp_node(sync_node.GetURL());
+ temp_node.SetTitle(sync_node.GetTitle());
if (sync_node.GetIsFolder())
temp_node.set_type(BookmarkNode::FOLDER);
else
@@ -230,14 +226,12 @@ bool ModelAssociator::BookmarkModelHasUserCreatedNodes() const {
bool ModelAssociator::SyncModelHasUserCreatedNodes() {
int64 bookmark_bar_sync_id;
- if (!GetSyncIdForTaggedNode(WideToUTF16(kBookmarkBarTag),
- &bookmark_bar_sync_id)) {
+ if (!GetSyncIdForTaggedNode(kBookmarkBarTag,&bookmark_bar_sync_id)) {
sync_service_->OnUnrecoverableError();
return false;
}
int64 other_bookmarks_sync_id;
- if (!GetSyncIdForTaggedNode(WideToUTF16(kOtherBookmarksTag),
- &other_bookmarks_sync_id)) {
+ if (!GetSyncIdForTaggedNode(kOtherBookmarksTag, &other_bookmarks_sync_id)) {
sync_service_->OnUnrecoverableError();
return false;
}
@@ -265,12 +259,12 @@ bool ModelAssociator::SyncModelHasUserCreatedNodes() {
bool ModelAssociator::NodesMatch(const BookmarkNode* bookmark,
const sync_api::BaseNode* sync_node) const {
- if (bookmark->GetTitle() != UTF16ToWide(sync_node->GetTitle()))
+ if (bookmark->GetTitle() != sync_node->GetTitle())
return false;
if (bookmark->is_folder() != sync_node->GetIsFolder())
return false;
if (bookmark->is_url()) {
- if (bookmark->GetURL() != GURL(sync_node->GetURL()))
+ if (bookmark->GetURL() != sync_node->GetURL())
return false;
}
// Don't compare favicons here, because they are not really
@@ -280,8 +274,7 @@ bool ModelAssociator::NodesMatch(const BookmarkNode* bookmark,
}
bool ModelAssociator::AssociateTaggedPermanentNode(
- const BookmarkNode* permanent_node,
- const string16 &tag) {
+ const BookmarkNode* permanent_node, const std::string&tag) {
// Do nothing if |permanent_node| is already initialized and associated.
int64 sync_id = GetSyncIdFromBookmarkId(permanent_node->id());
if (sync_id != sync_api::kInvalidId)
@@ -293,7 +286,7 @@ bool ModelAssociator::AssociateTaggedPermanentNode(
return true;
}
-bool ModelAssociator::GetSyncIdForTaggedNode(const string16& tag,
+bool ModelAssociator::GetSyncIdForTaggedNode(const std::string& tag,
int64* sync_id) {
sync_api::ReadTransaction trans(
sync_service_->backend()->GetUserShareHandle());
@@ -340,15 +333,14 @@ bool ModelAssociator::BuildAssociations() {
// To prime our association, we associate the top-level nodes, Bookmark Bar
// and Other Bookmarks.
- if (!AssociateTaggedPermanentNode(model->other_node(),
- WideToUTF16(kOtherBookmarksTag))) {
+ if (!AssociateTaggedPermanentNode(model->other_node(), kOtherBookmarksTag)) {
sync_service_->OnUnrecoverableError();
LOG(ERROR) << "Server did not create top-level nodes. Possibly we "
<< "are running against an out-of-date server?";
return false;
}
if (!AssociateTaggedPermanentNode(model->GetBookmarkBarNode(),
- WideToUTF16(kBookmarkBarTag))) {
+ kBookmarkBarTag)) {
sync_service_->OnUnrecoverableError();
LOG(ERROR) << "Server did not create top-level nodes. Possibly we "
<< "are running against an out-of-date server?";
@@ -489,14 +481,13 @@ bool ModelAssociator::LoadAssociations() {
// create the tagged nodes on demand, and the order in which we probe for
// them here will impact their positional ordering in that case.
int64 bookmark_bar_id;
- if (!GetSyncIdForTaggedNode(WideToUTF16(kBookmarkBarTag), &bookmark_bar_id)) {
+ if (!GetSyncIdForTaggedNode(kBookmarkBarTag, &bookmark_bar_id)) {
// We should always be able to find the permanent nodes.
sync_service_->OnUnrecoverableError();
return false;
}
int64 other_bookmarks_id;
- if (!GetSyncIdForTaggedNode(WideToUTF16(kOtherBookmarksTag),
- &other_bookmarks_id)) {
+ if (!GetSyncIdForTaggedNode(kOtherBookmarksTag, &other_bookmarks_id)) {
// We should always be able to find the permanent nodes.
sync_service_->OnUnrecoverableError();
return false;
diff --git a/chrome/browser/sync/glue/model_associator.h b/chrome/browser/sync/glue/model_associator.h
index 0304bf5..d869010 100644
--- a/chrome/browser/sync/glue/model_associator.h
+++ b/chrome/browser/sync/glue/model_associator.h
@@ -12,7 +12,6 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "base/string16.h"
class BookmarkNode;
@@ -86,7 +85,7 @@ class ModelAssociator
// Stores the id of the node with the given tag in |sync_id|.
// Returns of that node was found successfully.
// Tests override this.
- virtual bool GetSyncIdForTaggedNode(const string16& tag, int64* sync_id);
+ virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id);
// Returns sync service instance.
ProfileSyncService* sync_service() { return sync_service_; }
@@ -116,7 +115,7 @@ class ModelAssociator
// user's share. For example, "other_bookmarks" is the tag for the Other
// Bookmarks folder. The sync nodes are server-created.
bool AssociateTaggedPermanentNode(const BookmarkNode* permanent_node,
- const string16& tag);
+ const std::string& tag);
// Compare the properties of a pair of nodes from either domain.
bool NodesMatch(const BookmarkNode* bookmark,
diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h
index 8697e0d..91911e3 100644
--- a/chrome/browser/sync/glue/sync_backend_host.h
+++ b/chrome/browser/sync/glue/sync_backend_host.h
@@ -198,7 +198,7 @@ class SyncBackendHost {
sync_api::HttpPostProviderFactory* auth_factory) {
DoInitialize(GURL(), bookmark_model_worker, false, factory,
auth_factory);
- syncapi_->SetupForTestMode(WideToUTF16(test_user).c_str());
+ syncapi_->SetupForTestMode(test_user);
}
#endif
diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc
index 892c96d..7b2701f 100644
--- a/chrome/browser/sync/profile_sync_service_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_unittest.cc
@@ -34,7 +34,13 @@ class TestModelAssociator : public ModelAssociator {
: ModelAssociator(service) {
}
- virtual bool GetSyncIdForTaggedNode(const string16& tag, int64* sync_id) {
+ virtual bool GetSyncIdForTaggedNode(const std::string& tag, int64* sync_id) {
+ std::wstring tag_wide;
+ if (!UTF8ToWide(tag.c_str(), tag.length(), &tag_wide)) {
+ NOTREACHED() << "Unable to convert UTF8 to wide for string: " << tag;
+ return false;
+ }
+
sync_api::WriteTransaction trans(
sync_service()->backend()->GetUserShareHandle());
sync_api::ReadNode root(&trans);
@@ -48,7 +54,7 @@ class TestModelAssociator : public ModelAssociator {
sync_api::ReadNode child(&trans);
child.InitByIdLookup(id);
last_child_id = id;
- if (tag == child.GetTitle()) {
+ if (tag_wide == child.GetTitle()) {
*sync_id = id;
return true;
}
@@ -65,7 +71,7 @@ class TestModelAssociator : public ModelAssociator {
// Create new fake tagged nodes at the end of the ordering.
node.InitByCreation(root, predecessor);
node.SetIsFolder(true);
- node.SetTitle(tag.c_str());
+ node.SetTitle(tag_wide);
node.SetExternalId(0);
*sync_id = node.GetId();
return true;
@@ -118,7 +124,7 @@ class FakeServerChange {
// Pretend that the server told the syncer to add a bookmark object.
int64 Add(const std::wstring& title,
- const std::wstring& url,
+ const std::string& url,
bool is_folder,
int64 parent_id,
int64 predecessor_id) {
@@ -136,12 +142,9 @@ class FakeServerChange {
EXPECT_EQ(node.GetPredecessorId(), predecessor_id);
EXPECT_EQ(node.GetParentId(), parent_id);
node.SetIsFolder(is_folder);
- node.SetTitle(WideToUTF16(title).c_str());
- if (!is_folder) {
- string16 url16(WideToUTF16(url));
- GURL gurl(url16);
- node.SetURL(url16.c_str());
- }
+ node.SetTitle(title);
+ if (!is_folder)
+ node.SetURL(GURL(url));
sync_api::SyncManager::ChangeRecord record;
record.action = sync_api::SyncManager::ChangeRecord::ACTION_ADD;
record.id = node.GetId();
@@ -153,12 +156,12 @@ class FakeServerChange {
int64 AddFolder(const std::wstring& title,
int64 parent_id,
int64 predecessor_id) {
- return Add(title, std::wstring(), true, parent_id, predecessor_id);
+ return Add(title, std::string(), true, parent_id, predecessor_id);
}
// Add a bookmark.
int64 AddURL(const std::wstring& title,
- const std::wstring& url,
+ const std::string& url,
int64 parent_id,
int64 predecessor_id) {
return Add(title, url, false, parent_id, predecessor_id);
@@ -194,24 +197,12 @@ class FakeServerChange {
std::wstring ModifyTitle(int64 id, const std::wstring& new_title) {
sync_api::WriteNode node(trans_);
EXPECT_TRUE(node.InitByIdLookup(id));
- std::wstring old_title = UTF16ToWide(node.GetTitle());
- node.SetTitle(WideToUTF16(new_title).c_str());
+ std::wstring old_title = node.GetTitle();
+ node.SetTitle(new_title);
SetModified(id);
return old_title;
}
- // Set a new URL value, and return the old value.
- // TODO(ncarter): Determine if URL modifications are even legal.
- std::wstring ModifyURL(int64 id, const std::wstring& new_url) {
- sync_api::WriteNode node(trans_);
- EXPECT_TRUE(node.InitByIdLookup(id));
- EXPECT_FALSE(node.GetIsFolder());
- std::wstring old_url = UTF16ToWide(node.GetURL());
- node.SetURL(WideToUTF16(new_url).c_str());
- SetModified(id);
- return old_url;
- }
-
// Set a new parent and predecessor value. Return the old parent id.
// We could return the old predecessor id, but it turns out not to be
// very useful for assertions.
@@ -332,13 +323,13 @@ class ProfileSyncServiceTest : public testing::Test {
// Non-root node titles and parents must match.
if (bnode != model_->GetBookmarkBarNode() &&
bnode != model_->other_node()) {
- EXPECT_EQ(bnode->GetTitle(), UTF16ToWide(gnode.GetTitle()));
+ EXPECT_EQ(bnode->GetTitle(), gnode.GetTitle());
EXPECT_EQ(associator()->GetBookmarkNodeFromSyncId(gnode.GetParentId()),
bnode->GetParent());
}
EXPECT_EQ(bnode->is_folder(), gnode.GetIsFolder());
if (bnode->is_url())
- EXPECT_EQ(bnode->GetURL(), GURL(gnode.GetURL()));
+ EXPECT_EQ(bnode->GetURL(), gnode.GetURL());
// Check for position matches.
int browser_index = bnode->GetParent()->IndexOfChild(bnode);
@@ -414,8 +405,7 @@ class ProfileSyncServiceTest : public testing::Test {
const BookmarkNode* bnode =
associator()->GetBookmarkNodeFromSyncId(sync_id);
ASSERT_TRUE(bnode);
- GURL url2(url);
- EXPECT_EQ(url2, bnode->GetURL());
+ EXPECT_EQ(GURL(url), bnode->GetURL());
}
void ExpectBrowserNodeParent(int64 sync_id, int64 parent_sync_id) {
@@ -544,19 +534,19 @@ TEST_F(ProfileSyncServiceTest, ServerChangeProcessing) {
FakeServerChange adds(&trans);
int64 f1 = adds.AddFolder(L"Server Folder B", bookmark_bar_id(), 0);
int64 f2 = adds.AddFolder(L"Server Folder A", bookmark_bar_id(), f1);
- int64 u1 = adds.AddURL(L"Some old site", L"ftp://nifty.andrew.cmu.edu/",
+ int64 u1 = adds.AddURL(L"Some old site", "ftp://nifty.andrew.cmu.edu/",
bookmark_bar_id(), f2);
- int64 u2 = adds.AddURL(L"Nifty", L"ftp://nifty.andrew.cmu.edu/", f1, 0);
+ int64 u2 = adds.AddURL(L"Nifty", "ftp://nifty.andrew.cmu.edu/", f1, 0);
// u3 is a duplicate URL
- int64 u3 = adds.AddURL(L"Nifty2", L"ftp://nifty.andrew.cmu.edu/", f1, u2);
+ int64 u3 = adds.AddURL(L"Nifty2", "ftp://nifty.andrew.cmu.edu/", f1, u2);
// u4 is a duplicate title, different URL.
- adds.AddURL(L"Some old site", L"http://slog.thestranger.com/",
+ adds.AddURL(L"Some old site", "http://slog.thestranger.com/",
bookmark_bar_id(), u1);
// u5 tests an empty-string title.
- std::wstring javascript_url(L"javascript:(function(){var w=window.open(" \
- L"'about:blank','gnotesWin','location=0,menubar=0," \
- L"scrollbars=0,status=0,toolbar=0,width=300," \
- L"height=300,resizable');});");
+ std::string javascript_url("javascript:(function(){var w=window.open(" \
+ "'about:blank','gnotesWin','location=0,menubar=0," \
+ "scrollbars=0,status=0,toolbar=0,width=300," \
+ "height=300,resizable');});");
adds.AddURL(L"", javascript_url, other_bookmarks_id(), 0);
vector<sync_api::SyncManager::ChangeRecord>::const_iterator it;
@@ -631,7 +621,7 @@ TEST_F(ProfileSyncServiceTest, ServerChangeRequiringFosterParent) {
// Stress the immediate children of other_node because that's where
// ApplyModelChanges puts a temporary foster parent node.
- std::wstring url(L"http://dev.chromium.org/");
+ std::string url("http://dev.chromium.org/");
FakeServerChange adds(&trans);
int64 f0 = other_bookmarks_id(); // + other_node
int64 f1 = adds.AddFolder(L"f1", f0, 0); // + f1
@@ -681,7 +671,7 @@ TEST_F(ProfileSyncServiceTest, ServerChangeWithNonCanonicalURL) {
FakeServerChange adds(&trans);
std::string url("http://dev.chromium.org");
EXPECT_NE(GURL(url).spec(), url);
- adds.AddURL(L"u1", UTF8ToWide(url), other_bookmarks_id(), 0);
+ adds.AddURL(L"u1", url, other_bookmarks_id(), 0);
adds.ApplyPendingChanges(change_processor());
@@ -710,8 +700,9 @@ TEST_F(ProfileSyncServiceTest, DISABLED_ServerChangeWithInvalidURL) {
sync_api::WriteTransaction trans(backend()->GetUserShareHandle());
FakeServerChange adds(&trans);
- EXPECT_FALSE(GURL("x").is_valid());
- adds.AddURL(L"u1", L"x", other_bookmarks_id(), 0);
+ std::string url("x");
+ EXPECT_FALSE(GURL(url).is_valid());
+ adds.AddURL(L"u1", url, other_bookmarks_id(), 0);
adds.ApplyPendingChanges(change_processor());
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index 978eb43..3d15a30 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -822,8 +822,7 @@ void BookmarkManagerView::UpdateSyncStatus() {
&status_label, &link_label) == SyncStatusUIHelper::SYNCED;
if (sync_service_->HasSyncSetupCompleted()) {
- std::wstring username = UTF16ToWide(
- sync_service_->GetAuthenticatedUsername());
+ std::wstring username = sync_service_->GetAuthenticatedUsername();
status_label = l10n_util::GetStringF(IDS_SYNC_NTP_SYNCED_TO, username);
} else if (!sync_service_->SetupInProgress() && !synced) {
status_label = l10n_util::GetString(IDS_SYNC_START_SYNC_BUTTON_LABEL);
diff --git a/chrome/test/live_sync/bookmark_model_verifier.cc b/chrome/test/live_sync/bookmark_model_verifier.cc
index 8dd0164..c1ac92d 100644
--- a/chrome/test/live_sync/bookmark_model_verifier.cc
+++ b/chrome/test/live_sync/bookmark_model_verifier.cc
@@ -15,6 +15,9 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
+using std::string;
+using std::wstring;
+
// static
void BookmarkModelVerifier::ExpectBookmarkInfoMatch(
const BookmarkNode* expected, const BookmarkNode* actual) {
@@ -126,7 +129,7 @@ void BookmarkModelVerifier::FindNodeInVerifier(BookmarkModel* foreign_model,
}
const BookmarkNode* BookmarkModelVerifier::AddGroup(BookmarkModel* model,
- const BookmarkNode* parent, int index, const string16& title) {
+ const BookmarkNode* parent, int index, const wstring& title) {
const BookmarkNode* v_parent = NULL;
FindNodeInVerifier(model, parent, &v_parent);
const BookmarkNode* result = model->AddGroup(parent, index, title);
@@ -143,7 +146,7 @@ const BookmarkNode* BookmarkModelVerifier::AddGroup(BookmarkModel* model,
const BookmarkNode* BookmarkModelVerifier::AddNonEmptyGroup(
BookmarkModel* model, const BookmarkNode* parent, int index,
- const string16& title, int children_count) {
+ const wstring& title, int children_count) {
const BookmarkNode* bm_folder = AddGroup(model, parent, index, title);
EXPECT_TRUE(bm_folder);
if (!bm_folder)
@@ -152,21 +155,19 @@ const BookmarkNode* BookmarkModelVerifier::AddNonEmptyGroup(
int random_int = base::RandInt(1, 100);
// To create randomness in order, 60% of time add bookmarks
if (random_int > 40) {
- string16 child_bm_title(bm_folder->GetTitle());
+ wstring child_bm_title(bm_folder->GetTitle());
child_bm_title.append(L"-ChildBM");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(child_index);
- child_bm_title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ child_bm_title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* child_nofavicon_bm =
AddURL(model, bm_folder, child_index, child_bm_title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 child_bmfolder_title(bm_folder->GetTitle());
+ wstring child_bmfolder_title(bm_folder->GetTitle());
child_bmfolder_title.append(L"-ChildBMFolder");
- string16 index_str = IntToString16(child_index);
- child_bmfolder_title.append(index_str);
+ child_bmfolder_title.append(IntToWString(index));
const BookmarkNode* child_bm_folder =
AddGroup(model, bm_folder, child_index, child_bmfolder_title);
}
@@ -175,7 +176,7 @@ const BookmarkNode* BookmarkModelVerifier::AddNonEmptyGroup(
}
const BookmarkNode* BookmarkModelVerifier::AddURL(BookmarkModel* model,
- const BookmarkNode* parent, int index, const string16& title,
+ const BookmarkNode* parent, int index, const wstring& title,
const GURL& url) {
const BookmarkNode* v_parent = NULL;
FindNodeInVerifier(model, parent, &v_parent);
@@ -193,7 +194,7 @@ const BookmarkNode* BookmarkModelVerifier::AddURL(BookmarkModel* model,
void BookmarkModelVerifier::SetTitle(BookmarkModel* model,
const BookmarkNode* node,
- const string16& title) {
+ const wstring& title) {
const BookmarkNode* v_node = NULL;
FindNodeInVerifier(model, node, &v_node);
model->SetTitle(node, title);
diff --git a/chrome/test/live_sync/bookmark_model_verifier.h b/chrome/test/live_sync/bookmark_model_verifier.h
index 9961f3a5..7498d01 100644
--- a/chrome/test/live_sync/bookmark_model_verifier.h
+++ b/chrome/test/live_sync/bookmark_model_verifier.h
@@ -31,14 +31,14 @@ class BookmarkModelVerifier {
const BookmarkNode* AddGroup(BookmarkModel* model,
const BookmarkNode* parent,
int index,
- const string16& title);
+ const std::wstring& title);
// Adds the same non-empty folder to |model| and |verifier|.
// It also adds specified number of childern (mix of bm and folder).
const BookmarkNode* AddNonEmptyGroup(BookmarkModel* model,
const BookmarkNode* parent,
int index,
- const string16& title,
+ const std::wstring& title,
int children_count);
// Adds the same bookmark to |model| and |verifier|.
@@ -46,13 +46,13 @@ class BookmarkModelVerifier {
const BookmarkNode* AddURL(BookmarkModel* model,
const BookmarkNode* parent,
int index,
- const string16& title,
+ const std::wstring& title,
const GURL& url);
// Sets the title of the same node in |model| and |verifier|.
// See BookmarkModel::SetTitle for details.
void SetTitle(BookmarkModel* model, const BookmarkNode* node,
- const string16& title);
+ const std::wstring& title);
// Moves the same node to the same position in both |model| and |verifier|.
// See BookmarkModel::Move for details.
diff --git a/chrome/test/live_sync/live_bookmarks_sync_test.cc b/chrome/test/live_sync/live_bookmarks_sync_test.cc
index 59b99c2..0fb4276 100644
--- a/chrome/test/live_sync/live_bookmarks_sync_test.cc
+++ b/chrome/test/live_sync/live_bookmarks_sync_test.cc
@@ -73,11 +73,10 @@ const BookmarkNode* LiveBookmarksSyncTest::GetByUniqueURL(BookmarkModel* m,
}
// static
-Profile* LiveBookmarksSyncTest::MakeProfile(const string16& name) {
- string16 path_string;
- PathService::Get(chrome::DIR_USER_DATA, &path_string);
- file_util::AppendToPath(&path_string, name);
- FilePath path(path_string);
+Profile* LiveBookmarksSyncTest::MakeProfile(const std::wstring& name) {
+ FilePath path;
+ PathService::Get(chrome::DIR_USER_DATA, &path);
+ path.Append(FilePath::FromWStringHack(name));
return ProfileManager::CreateProfile(path, name, L"", L"");
}
diff --git a/chrome/test/live_sync/live_bookmarks_sync_test.h b/chrome/test/live_sync/live_bookmarks_sync_test.h
index 1502569..c9d4486 100644
--- a/chrome/test/live_sync/live_bookmarks_sync_test.h
+++ b/chrome/test/live_sync/live_bookmarks_sync_test.h
@@ -55,7 +55,7 @@ class LiveBookmarksSyncTest : public InProcessBrowserTest {
static const BookmarkNode* GetByUniqueURL(BookmarkModel* m, const GURL& url);
// Helper to ProfileManager::CreateProfile that handles path creation.
- static Profile* MakeProfile(const string16& name);
+ static Profile* MakeProfile(const std::wstring& name);
// Utility to block (by running the current MessageLoop) until the model has
// loaded. Note this is required instead of using m->BlockTillLoaded, as that
diff --git a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc
index f82ee85..736833c 100644
--- a/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc
+++ b/chrome/test/live_sync/two_client_live_bookmarks_sync_test.cc
@@ -3,8 +3,9 @@
// found in the LICENSE file.
#include <stdlib.h>
+#include <string>
-#include "base/string16.h"
+#include "base/file_path.h"
#include "base/rand_util.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
@@ -16,6 +17,9 @@
#include "chrome/test/live_sync/live_bookmarks_sync_test.h"
#include "testing/gtest/include/gtest/gtest.h"
+using std::string;
+using std::wstring;
+
// TODO(tejasshah): Move single client tests to separate file.
// Some Abbreviations Used:
@@ -67,17 +71,17 @@ class TwoClientLiveBookmarksSyncTest : public LiveBookmarksSyncTest {
// This is used to pre-populate bookmarks hierarchy file to Client1 and
// Verifier Client.
- void PrePopulateBookmarksHierarchy(const string16 &bookmarks_file_name) {
+ void PrePopulateBookmarksHierarchy(const FilePath& bookmarks_file_name) {
// Let's create default profile directory.
FilePath dest_user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &dest_user_data_dir);
FilePath dest_user_data_dir_default = dest_user_data_dir.Append(
FILE_PATH_LITERAL("Default"));
- file_util::CreateDirectoryW(dest_user_data_dir_default);
+ file_util::CreateDirectory(dest_user_data_dir_default);
// Let's create verifier profile directory.
FilePath dest_user_data_dir_verifier = dest_user_data_dir.Append(
FILE_PATH_LITERAL("verifier"));
- file_util::CreateDirectoryW(dest_user_data_dir_verifier);
+ file_util::CreateDirectory(dest_user_data_dir_verifier);
// Let's prepare sync data source file path.
FilePath sync_data_source;
@@ -92,24 +96,21 @@ class TwoClientLiveBookmarksSyncTest : public LiveBookmarksSyncTest {
bookmarks_file_name);
ASSERT_TRUE(file_util::PathExists(source_file));
// Now copy pre-generated bookmark file to default profile.
- ASSERT_TRUE(file_util::CopyFileW(
- source_file, dest_user_data_dir_default.Append(
- FILE_PATH_LITERAL("bookmarks"))));
+ ASSERT_TRUE(file_util::CopyFile(source_file,
+ dest_user_data_dir_default.Append(FILE_PATH_LITERAL("bookmarks"))));
// Now copy pre-generated bookmark file to verifier profile.
- ASSERT_TRUE(file_util::CopyFileW(
- source_file, dest_user_data_dir_verifier.Append(
- FILE_PATH_LITERAL("bookmarks"))));
+ ASSERT_TRUE(file_util::CopyFile(source_file,
+ dest_user_data_dir_verifier.Append(FILE_PATH_LITERAL("bookmarks"))));
// Let's pre-populate bookmarks file for client2 also if we need to.
if (ShouldCopyBookmarksToClient2()) {
// Let's create verifier profile directory.
FilePath dest_user_data_dir_client2 = dest_user_data_dir.Append(
FILE_PATH_LITERAL("client2"));
- file_util::CreateDirectoryW(dest_user_data_dir_client2);
+ file_util::CreateDirectory(dest_user_data_dir_client2);
// Now copy pre-generated bookmark file to verifier profile.
- ASSERT_TRUE(file_util::CopyFileW(
- source_file, dest_user_data_dir_client2.Append(
- FILE_PATH_LITERAL("bookmarks"))));
+ ASSERT_TRUE(file_util::CopyFile(source_file,
+ dest_user_data_dir_client2.Append(FILE_PATH_LITERAL("bookmarks"))));
}
}
@@ -197,7 +198,7 @@ class LiveSyncTestBasicHierarchy50BM
virtual ~LiveSyncTestBasicHierarchy50BM() {}
virtual void SetUp() {
- const string16 file_name(L"bookmarks_50BM5F3L");
+ FilePath file_name(FILE_PATH_LITERAL("bookmarks_50BM5F3L"));
PrePopulateBookmarksHierarchy(file_name);
LiveBookmarksSyncTest::SetUp();
}
@@ -233,7 +234,7 @@ class LiveSyncTestComplexHierarchy800BM
LiveSyncTestComplexHierarchy800BM() {}
virtual ~LiveSyncTestComplexHierarchy800BM() {}
virtual void SetUp() {
- const string16 file_name(L"bookmarks_800BM32F8L");
+ FilePath file_name(FILE_PATH_LITERAL("bookmarks_800BM32F8L"));
TwoClientLiveBookmarksSyncTest::PrePopulateBookmarksHierarchy(file_name);
LiveBookmarksSyncTest::SetUp();
}
@@ -248,7 +249,7 @@ class LiveSyncTestHugeHierarchy5500BM
LiveSyncTestHugeHierarchy5500BM() {}
virtual ~LiveSyncTestHugeHierarchy5500BM() {}
virtual void SetUp() {
- const string16 file_name(L"bookmarks_5500BM125F25L");
+ FilePath file_name(FILE_PATH_LITERAL("bookmarks_5500BM125F25L"));
TwoClientLiveBookmarksSyncTest::PrePopulateBookmarksHierarchy(file_name);
LiveBookmarksSyncTest::SetUp();
}
@@ -267,7 +268,8 @@ class LiveSyncTestDefaultIEFavorites
virtual ~LiveSyncTestDefaultIEFavorites() {}
virtual void SetUp() {
- const string16 file_name(L"bookmarks_default_IE_favorites");
+ const FilePath file_name(
+ FILE_PATH_LITERAL("bookmarks_default_IE_favorites"));
TwoClientLiveBookmarksSyncTest::PrePopulateBookmarksHierarchy(file_name);
LiveBookmarksSyncTest::SetUp();
}
@@ -374,10 +376,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
verifier->ExpectMatch(model_one);
verifier->ExpectMatch(model_two);
- GURL initial_url(L"http://www.google.com");
- GURL second_url(L"http://www.google.com/abc");
- GURL third_url(L"http://www.google.com/def");
- std::wstring title = L"Google";
+ GURL initial_url("http://www.google.com");
+ GURL second_url("http://www.google.com/abc");
+ GURL third_url("http://www.google.com/def");
+ wstring title = L"Google";
{
const BookmarkNode* google = verifier->AddURL(model_one, bbn_one, 0,
title, initial_url);
@@ -596,22 +598,20 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
verifier->ExpectMatch(model_two);
// Let's add some bookmarks(without favicon)
for (int index = 0; index < 20; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, bbn_one, index, title, GURL(url));
}
for (int index = 0; index < 10; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, other_bm_one, index, title, GURL(url));
}
@@ -639,32 +639,29 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int = base::RandInt(1, 100);
// To create randomness in order, 40% of time add bookmarks
if (random_int > 60) {
- string16 title(L"BB - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"BB - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, bbn_one, index, title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"BB - TestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"BB - TestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* bm_folder = verifier->AddGroup(model_one, bbn_one,
index, title);
int random_int2 = base::RandInt(1, 100);
// 60% of time we will add bookmarks to added folder
if (random_int2 > 40) {
for (int index = 0; index < 20; index++) {
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- string16 child_title(title);
+ wstring child_title(title);
child_title.append(L" - ChildTestBM");
- child_title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ child_title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder, index, child_title, GURL(url));
}
@@ -673,12 +670,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
}
LOG(INFO) << "Adding several bookmarks under other bookmarks";
for (int index = 0; index < 10; index++) {
- string16 title(L"Other - TestBookmark");
- string16 url(L"http://www.nofaviconurl-other");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Other - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl-other");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, other_bm_one, index, title, GURL(url));
}
@@ -856,20 +852,18 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int = base::RandInt(1, 100);
// To create randomness in order, 85% of time add bookmarks
if (random_int > 15) {
- string16 title(L"Test BMFolder - ChildTestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Test BMFolder - ChildTestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, test_bm_folder, index,
title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"Test BMFolder - ChildTestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"Test BMFolder - ChildTestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* bm_folder =
verifier->AddGroup(model_one, test_bm_folder, index, title);
}
@@ -907,12 +901,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add few bookmarks under bookmark_bar.
for (int index = 1; index < 15; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, bbn_one, index, title, GURL(url));
}
@@ -925,20 +918,18 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int = base::RandInt(1, 100);
// To create randomness in order, 85% of time add bookmarks
if (random_int > 15) {
- string16 title(L"Test BMFolder - ChildTestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Test BMFolder - ChildTestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, test_bm_folder, index,
title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"Test BMFolder - ChildTestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"Test BMFolder - ChildTestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* bm_folder =
verifier->AddGroup(model_one, test_bm_folder, index, title);
}
@@ -1034,12 +1025,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
verifier->ExpectMatch(model_two);
// Let's add some bookmarks(without favicon)
for (int index = 0; index < 20; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(
model_one, bbn_one, index,
title, GURL(url));
@@ -1076,12 +1066,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
verifier->AddGroup(model_one, bbn_one, 0, L"TestFolder");
// Let's add some bookmarks(without favicon) to this folder
for (int index = 0; index < 10; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, bm_folder_one, index, title, GURL(url));
}
@@ -1117,12 +1106,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
0, L"TestFolder");
// Let's add some bookmarks(without favicon) to this folder
for (int index = 0; index < 10; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(
model_one, bm_folder_one,
index, title, GURL(url));
@@ -1160,12 +1148,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
verifier->AddGroup(model_one, bbn_one, 0, L"TestFolder");
// Let's add some bookmarks(without favicon) to this folder
for (int index = 0; index < 10; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, bm_folder_one, index, title, GURL(url));
}
@@ -1201,12 +1188,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
verifier->AddGroup(model_one, bbn_one, 0, L"TestFolder");
// Let's add some bookmarks(without favicon) to this folder
for (int index = 0; index < 10; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, bm_folder_one, index, title, GURL(url));
}
@@ -1275,19 +1261,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int = base::RandInt(1, 100);
// To create randomness in order, 40% of time add bookmarks
if (random_int > 60) {
- string16 title(L"BB - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"BB - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one, bbn_one,
index, title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"BB - TestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"BB - TestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* bm_folder = verifier->AddGroup(model_one, bbn_one,
index, title);
}
@@ -1329,19 +1313,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int = base::RandInt(1, 100);
// To create randomness in order, 40% of time add bookmarks
if (random_int > 60) {
- string16 title(L"BB - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"BB - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one, bbn_one,
index, title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"BB - TestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"BB - TestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* bm_folder = verifier->AddGroup(model_one, bbn_one,
index, title);
}
@@ -1349,12 +1331,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some bookmarks(without favicon) to bm_folder_one ('TestFolder')
for (int index = 0; index < 15; index++) {
- string16 title(L"Level2 - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Level2 - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder_one, index, title, GURL(url));
}
@@ -1396,19 +1377,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int = base::RandInt(1, 100);
// To create randomness in order, 40% of time add bookmarks
if (random_int > 60) {
- string16 title(L"BB - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"BB - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one, bbn_one,
index, title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"BB - TestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"BB - TestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* bm_folder = verifier->AddGroup(model_one, bbn_one,
index, title);
}
@@ -1420,19 +1399,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int = base::RandInt(1, 100);
// To create randomness in order, 40% of time add bookmarks
if (random_int > 60) {
- string16 title(L"Level2 - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Level2 - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder_one, index, title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"Level2 - TestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"Level2 - TestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* l2_bm_folder = verifier->AddGroup(model_one,
bm_folder_one, index, title);
int random_int2 = base::RandInt(1, 100);
@@ -1443,19 +1420,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int3 = base::RandInt(1, 100);
// To create randomness in order, 40% of time add bookmarks
if (random_int3 > 60) {
- string16 title(L"Level3 - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index2);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Level3 - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
l2_bm_folder, index2, title, GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"Level3 - TestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"Level3 - TestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* l3_bm_folder =
verifier->AddGroup(model_one, l2_bm_folder, index2, title);
}
@@ -1496,12 +1471,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add few bookmarks under bookmark_bar.
for (int index = 1; index < 11; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, bbn_one, index, title, GURL(url));
}
@@ -1514,20 +1488,18 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
int random_int = base::RandInt(1, 100);
// To create randomness in order, 80% of time add bookmarks
if (random_int > 20) {
- string16 title(L"Test BMFolder - ChildTestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Test BMFolder - ChildTestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, test_bm_folder, index, title,
GURL(url));
} else {
// Remaining % of time - Add Bookmark folders
- string16 title(L"Test BMFolder - ChildTestBMFolder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"Test BMFolder - ChildTestBMFolder");
+ title.append(IntToWString(index));
const BookmarkNode* bm_folder =
verifier->AddGroup(model_one, test_bm_folder, index, title);
}
@@ -1594,12 +1566,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add 10 bookmarks like 0123456789
for (int index = 0; index < 10; index++) {
- string16 title(L"BM-");
- string16 url(L"http://www.nofaviconurl-");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"BM-");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl-");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bbn_one, index, title, GURL(url));
}
@@ -1638,12 +1609,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some bookmarks(without favicon) to bookmark bar
for (int index = 2; index < 10; index++) {
int random_int = base::RandInt(1, 100);
- string16 title(L"BB - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"BB - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one, bbn_one,
index, title, GURL(url));
}
@@ -1683,12 +1653,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some bookmarks(without favicon) to bm_folder_one
for (int index = 0; index < 10; index++) {
int random_int = base::RandInt(1, 100);
- string16 title(L"BB - TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"BB - TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder_one, index, title, GURL(url));
}
@@ -1737,12 +1706,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add few bookmarks under child_folder.
for (int index = 0; index < 10; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm =
verifier->AddURL(model_one, child_folder, index, title, GURL(url));
}
@@ -1843,19 +1811,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some bookmarks(without favicon) to bm_folder.
int child_count = base::RandInt(0, 10);
for (int index = 0; index < child_count; index++) {
- string16 title(bm_folder->GetTitle());
+ wstring title(bm_folder->GetTitle());
title.append(L"-BM");
- string16 url(L"http://www.nofaviconurl-");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ string url("http://www.nofaviconurl-");
+ title.append(IntToWString(index));
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder, index, title, GURL(url));
}
- string16 title(L"Test BMFolder-");
- string16 level_str = IntToString16(level);
- title.append(level_str);
+ wstring title(L"Test BMFolder-");
+ title.append(IntToWString(level));
bm_folder = verifier->AddGroup(model_one,
bm_folder, bm_folder->GetChildCount(), title);
@@ -1914,19 +1880,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some bookmarks(without favicon) to bm_folder.
int child_count = base::RandInt(0, 10);
for (int index = 0; index < child_count; index++) {
- string16 title(bm_folder->GetTitle());
+ wstring title(bm_folder->GetTitle());
title.append(L"-BM");
- string16 url(L"http://www.nofaviconurl-");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ string url("http://www.nofaviconurl-");
+ title.append(IntToWString(index));
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder, index, title, GURL(url));
}
- string16 title(L"Test BMFolder-");
- string16 level_str = IntToString16(level);
- title.append(level_str);
+ wstring title(L"Test BMFolder-");
+ title.append(IntToWString(level));
bm_folder = verifier->AddGroup(model_one,
bm_folder, bm_folder->GetChildCount(), title);
@@ -1988,19 +1952,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some bookmarks(without favicon) to bm_folder.
int child_count = base::RandInt(0, 10);
for (int index = 0; index < child_count; index++) {
- string16 title(bm_folder->GetTitle());
+ wstring title(bm_folder->GetTitle());
title.append(L"-BM");
- string16 url(L"http://www.nofaviconurl-");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ string url("http://www.nofaviconurl-");
+ title.append(IntToWString(index));
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder, index, title, GURL(url));
}
- string16 title(L"Test BMFolder-");
- string16 level_str = IntToString16(level);
- title.append(level_str);
+ wstring title(L"Test BMFolder-");
+ title.append(IntToWString(level));
bm_folder = verifier->AddGroup(model_one,
bm_folder, bm_folder->GetChildCount(), title);
@@ -2046,19 +2008,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some bookmarks (without favicon) to bm_folder.
int child_count = base::RandInt(0, 10);
for (int index = 0; index < child_count; index++) {
- string16 title(bm_folder->GetTitle());
+ wstring title(bm_folder->GetTitle());
title.append(L"-BM");
- string16 url(L"http://www.nofaviconurl-");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ string url("http://www.nofaviconurl-");
+ title.append(IntToWString(index));
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder, index, title, GURL(url));
}
- string16 title(L"Test BMFolder-");
- string16 level_str = IntToString16(level);
- title.append(level_str);
+ wstring title(L"Test BMFolder-");
+ title.append(IntToWString(level));
bm_folder = verifier->AddGroup(model_one,
bm_folder, bm_folder->GetChildCount(), title);
@@ -2071,13 +2031,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
bbn_one, bbn_one->GetChildCount(), L"MyTest BMFolder");
// Let's add few bookmarks to my_bm_folder.
for (int index = 0; index < 10; index++) {
- string16 title(bm_folder->GetTitle());
+ wstring title(bm_folder->GetTitle());
title.append(L"-BM");
- string16 url(L"http://www.nofaviconurl-");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ string url("http://www.nofaviconurl-");
+ title.append(IntToWString(index));
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
my_bm_folder, index, title, GURL(url));
}
@@ -2116,19 +2075,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some bookmarks(without favicon) to bm_folder.
int child_count = base::RandInt(0, 10);
for (int index = 0; index < child_count; index++) {
- string16 title(bm_folder->GetTitle());
+ wstring title(bm_folder->GetTitle());
title.append(L"-BM");
- string16 url(L"http://www.nofaviconurl-");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ string url("http://www.nofaviconurl-");
+ title.append(IntToWString(index));
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
bm_folder, index, title, GURL(url));
}
- string16 title(L"Test BMFolder-");
- string16 level_str = IntToString16(level);
- title.append(level_str);
+ wstring title(L"Test BMFolder-");
+ title.append(IntToWString(level));
bm_folder = verifier->AddGroup(model_one,
bm_folder, bm_folder->GetChildCount(), title);
@@ -2141,13 +2098,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
bm_folder_L5, bm_folder_L5->GetChildCount(), L"MyTest BMFolder");
// Let's add few bookmarks to my_bm_folder.
for (int index = 0; index < 10; index++) {
- string16 title(bm_folder->GetTitle());
+ wstring title(bm_folder->GetTitle());
title.append(L"-BM");
- string16 url(L"http://www.nofaviconurl-");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ string url("http://www.nofaviconurl-");
+ title.append(IntToWString(index));
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm = verifier->AddURL(model_one,
my_bm_folder, index, title, GURL(url));
}
@@ -2213,9 +2169,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add 10 non-empty bookmark folders like 0123456789
for (int index = 0; index < 10; index++) {
- string16 title(L"BM Folder");
- string16 index_str = IntToString16(index);
- title.append(index_str);
+ wstring title(L"BM Folder");
+ title.append(IntToWString(index));
const BookmarkNode* child_bm_folder = verifier->AddNonEmptyGroup(
model_one, bbn_one, index, title, 10);
}
@@ -2327,12 +2282,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add same bookmarks (without favicon) to both clients.
for (int index = 0; index < 3; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm_client1 =
model_one->AddURL(bbn_one, index, title, GURL(url));
const BookmarkNode* nofavicon_bm_client2 =
@@ -2341,24 +2295,22 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some different bookmarks (without favicon) to client1.
for (int index = 3; index < 11 ; index++) {
- string16 title(L"Client1-TestBookmark");
- string16 url(L"http://www.client1-nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Client1-TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.client1-nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm_client1 =
model_one->AddURL(bbn_one, index, title, GURL(url));
}
// Let's add some different bookmarks (without favicon) to client2.
for (int index = 3; index < 11 ; index++) {
- string16 title(L"Client2-TestBookmark");
- string16 url(L"http://www.Client2-nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Client2-TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.Client2-nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm_client2 =
model_two->AddURL(bbn_two, index, title, GURL(url));
}
@@ -2395,12 +2347,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add same bookmarks (without favicon) to both clients.
for (int index = 0; index < 3 ; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm_client1 =
model_one->AddURL(bbn_one, index, title, GURL(url));
const BookmarkNode* nofavicon_bm_client2 =
@@ -2409,12 +2360,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add some different bookmarks (without favicon) to client2.
for (int index = 3; index < 5 ; index++) {
- string16 title(L"Client2-TestBookmark");
- string16 url(L"http://www.client2-nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"Client2-TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.client2-nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm_client2 =
model_two->AddURL(bbn_two, index, title, GURL(url));
}
@@ -2451,12 +2401,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientLiveBookmarksSyncTest,
// Let's add same bookmarks (without favicon) to both clients.
for (int index = 0; index < 3 ; index++) {
- string16 title(L"TestBookmark");
- string16 url(L"http://www.nofaviconurl");
- string16 index_str = IntToString16(index);
- title.append(index_str);
- url.append(index_str);
- url.append(L".com");
+ wstring title(L"TestBookmark");
+ title.append(IntToWString(index));
+ string url("http://www.nofaviconurl");
+ url.append(IntToString(index));
+ url.append(".com");
const BookmarkNode* nofavicon_bm_client1 =
model_one->AddURL(bbn_one, index, title, GURL(url));
const BookmarkNode* nofavicon_bm_client2 =