diff options
author | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 21:15:33 +0000 |
---|---|---|
committer | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 21:15:33 +0000 |
commit | 7fd41a837aef6af92487dccfcc2819e3de8c6e41 (patch) | |
tree | e5e9cd67fd3b3b828002cc345a2632b4e00688d0 /chrome/test | |
parent | d37e8c5be9976f051c50529eb39a29d56cfd0dc1 (diff) | |
download | chromium_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/test')
5 files changed, 267 insertions, 318 deletions
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 = |