diff options
author | haitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-11 06:34:03 +0000 |
---|---|---|
committer | haitaol@chromium.org <haitaol@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-11 06:34:03 +0000 |
commit | 484fff5fdc1775264dd33b67b8ad584a90197386 (patch) | |
tree | 5174074bf39909bb6538047d61e138423a18445d | |
parent | 26f5efb1b4d8c848d8858e8031ddf9327733062f (diff) | |
download | chromium_src-484fff5fdc1775264dd33b67b8ad584a90197386.zip chromium_src-484fff5fdc1775264dd33b67b8ad584a90197386.tar.gz chromium_src-484fff5fdc1775264dd33b67b8ad584a90197386.tar.bz2 |
Add integraton test for sync backup/rollback.
BUG=362679
Review URL: https://codereview.chromium.org/310103004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276281 0039d316-1c4b-4281-b951-d872f2087c98
15 files changed, 397 insertions, 245 deletions
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index ac1e5f9..dee13e1 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc @@ -412,14 +412,14 @@ BookmarkModel* GetVerifierBookmarkModel() { } const BookmarkNode* AddURL(int profile, - const std::wstring& title, + const std::string& title, const GURL& url) { return AddURL(profile, GetBookmarkBarNode(profile), 0, title, url); } const BookmarkNode* AddURL(int profile, int index, - const std::wstring& title, + const std::string& title, const GURL& url) { return AddURL(profile, GetBookmarkBarNode(profile), index, title, url); } @@ -427,7 +427,7 @@ const BookmarkNode* AddURL(int profile, const BookmarkNode* AddURL(int profile, const BookmarkNode* parent, int index, - const std::wstring& title, + const std::string& title, const GURL& url) { BookmarkModel* model = GetBookmarkModel(profile); if (GetBookmarkNodeByID(model, parent->id()) != parent) { @@ -436,7 +436,7 @@ const BookmarkNode* AddURL(int profile, return NULL; } const BookmarkNode* result = - model->AddURL(parent, index, base::WideToUTF16(title), url); + model->AddURL(parent, index, base::UTF8ToUTF16(title), url); if (!result) { LOG(ERROR) << "Could not add bookmark " << title << " to Profile " << profile; @@ -446,7 +446,7 @@ const BookmarkNode* AddURL(int profile, const BookmarkNode* v_parent = NULL; FindNodeInVerifier(model, parent, &v_parent); const BookmarkNode* v_node = GetVerifierBookmarkModel()->AddURL( - v_parent, index, base::WideToUTF16(title), url); + v_parent, index, base::UTF8ToUTF16(title), url); if (!v_node) { LOG(ERROR) << "Could not add bookmark " << title << " to the verifier"; return NULL; @@ -457,20 +457,20 @@ const BookmarkNode* AddURL(int profile, } const BookmarkNode* AddFolder(int profile, - const std::wstring& title) { + const std::string& title) { return AddFolder(profile, GetBookmarkBarNode(profile), 0, title); } const BookmarkNode* AddFolder(int profile, int index, - const std::wstring& title) { + const std::string& title) { return AddFolder(profile, GetBookmarkBarNode(profile), index, title); } const BookmarkNode* AddFolder(int profile, const BookmarkNode* parent, int index, - const std::wstring& title) { + const std::string& title) { BookmarkModel* model = GetBookmarkModel(profile); if (GetBookmarkNodeByID(model, parent->id()) != parent) { LOG(ERROR) << "Node " << parent->GetTitle() << " does not belong to " @@ -478,7 +478,7 @@ const BookmarkNode* AddFolder(int profile, return NULL; } const BookmarkNode* result = - model->AddFolder(parent, index, base::WideToUTF16(title)); + model->AddFolder(parent, index, base::UTF8ToUTF16(title)); EXPECT_TRUE(result); if (!result) { LOG(ERROR) << "Could not add folder " << title << " to Profile " @@ -489,7 +489,7 @@ const BookmarkNode* AddFolder(int profile, const BookmarkNode* v_parent = NULL; FindNodeInVerifier(model, parent, &v_parent); const BookmarkNode* v_node = GetVerifierBookmarkModel()->AddFolder( - v_parent, index, base::WideToUTF16(title)); + v_parent, index, base::UTF8ToUTF16(title)); if (!v_node) { LOG(ERROR) << "Could not add folder " << title << " to the verifier"; return NULL; @@ -501,7 +501,7 @@ const BookmarkNode* AddFolder(int profile, void SetTitle(int profile, const BookmarkNode* node, - const std::wstring& new_title) { + const std::string& new_title) { BookmarkModel* model = GetBookmarkModel(profile); ASSERT_EQ(GetBookmarkNodeByID(model, node->id()), node) << "Node " << node->GetTitle() << " does not belong to " @@ -509,9 +509,9 @@ void SetTitle(int profile, if (sync_datatype_helper::test()->use_verifier()) { const BookmarkNode* v_node = NULL; FindNodeInVerifier(model, node, &v_node); - GetVerifierBookmarkModel()->SetTitle(v_node, base::WideToUTF16(new_title)); + GetVerifierBookmarkModel()->SetTitle(v_node, base::UTF8ToUTF16(new_title)); } - model->SetTitle(node, base::WideToUTF16(new_title)); + model->SetTitle(node, base::UTF8ToUTF16(new_title)); } void SetFavicon(int profile, @@ -752,16 +752,16 @@ const BookmarkNode* GetUniqueNodeByURL(int profile, const GURL& url) { return nodes[0]; } -int CountBookmarksWithTitlesMatching(int profile, const std::wstring& title) { +int CountBookmarksWithTitlesMatching(int profile, const std::string& title) { return CountNodesWithTitlesMatching(GetBookmarkModel(profile), BookmarkNode::URL, - base::WideToUTF16(title)); + base::UTF8ToUTF16(title)); } -int CountFoldersWithTitlesMatching(int profile, const std::wstring& title) { +int CountFoldersWithTitlesMatching(int profile, const std::string& title) { return CountNodesWithTitlesMatching(GetBookmarkModel(profile), BookmarkNode::FOLDER, - base::WideToUTF16(title)); + base::UTF8ToUTF16(title)); } gfx::Image CreateFavicon(SkColor color) { @@ -803,20 +803,20 @@ std::string IndexedURL(int i) { return base::StringPrintf("http://www.host.ext:1234/path/filename/%d", i); } -std::wstring IndexedURLTitle(int i) { - return base::StringPrintf(L"URL Title %d", i); +std::string IndexedURLTitle(int i) { + return base::StringPrintf("URL Title %d", i); } -std::wstring IndexedFolderName(int i) { - return base::StringPrintf(L"Folder Name %d", i); +std::string IndexedFolderName(int i) { + return base::StringPrintf("Folder Name %d", i); } -std::wstring IndexedSubfolderName(int i) { - return base::StringPrintf(L"Subfolder Name %d", i); +std::string IndexedSubfolderName(int i) { + return base::StringPrintf("Subfolder Name %d", i); } -std::wstring IndexedSubsubfolderName(int i) { - return base::StringPrintf(L"Subsubfolder Name %d", i); +std::string IndexedSubsubfolderName(int i) { + return base::StringPrintf("Subsubfolder Name %d", i); } } // namespace bookmarks_helper diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.h b/chrome/browser/sync/test/integration/bookmarks_helper.h index 5604dea..b878390 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.h +++ b/chrome/browser/sync/test/integration/bookmarks_helper.h @@ -38,7 +38,7 @@ BookmarkModel* GetVerifierBookmarkModel() WARN_UNUSED_RESULT; // profile |profile|. Returns a pointer to the node that was added. const BookmarkNode* AddURL( int profile, - const std::wstring& title, + const std::string& title, const GURL& url) WARN_UNUSED_RESULT; // Adds a URL with address |url| and title |title| to the bookmark bar of @@ -47,7 +47,7 @@ const BookmarkNode* AddURL( const BookmarkNode* AddURL( int profile, int index, - const std::wstring& title, + const std::string& title, const GURL& url) WARN_UNUSED_RESULT; // Adds a URL with address |url| and title |title| under the node |parent| of @@ -57,21 +57,21 @@ const BookmarkNode* AddURL( int profile, const BookmarkNode* parent, int index, - const std::wstring& title, + const std::string& title, const GURL& url) WARN_UNUSED_RESULT; // Adds a folder named |title| to the bookmark bar of profile |profile|. // Returns a pointer to the folder that was added. const BookmarkNode* AddFolder( int profile, - const std::wstring& title) WARN_UNUSED_RESULT; + const std::string& title) WARN_UNUSED_RESULT; // Adds a folder named |title| to the bookmark bar of profile |profile| at // position |index|. Returns a pointer to the folder that was added. const BookmarkNode* AddFolder( int profile, int index, - const std::wstring& title) WARN_UNUSED_RESULT; + const std::string& title) WARN_UNUSED_RESULT; // Adds a folder named |title| to the node |parent| in the bookmark model of // profile |profile| at position |index|. Returns a pointer to the node that @@ -80,13 +80,13 @@ const BookmarkNode* AddFolder( int profile, const BookmarkNode* parent, int index, - const std::wstring& title) WARN_UNUSED_RESULT; + const std::string& title) WARN_UNUSED_RESULT; // Changes the title of the node |node| in the bookmark model of profile // |profile| to |new_title|. void SetTitle(int profile, const BookmarkNode* node, - const std::wstring& new_title); + const std::string& new_title); // The source of the favicon. enum FaviconSource { @@ -172,13 +172,13 @@ const BookmarkNode* GetUniqueNodeByURL( // whose titles match the string |title|. int CountBookmarksWithTitlesMatching( int profile, - const std::wstring& title) WARN_UNUSED_RESULT; + const std::string& title) WARN_UNUSED_RESULT; // Returns the number of bookmark folders in the bookmark model of profile // |profile| whose titles contain the query string |title|. int CountFoldersWithTitlesMatching( int profile, - const std::wstring& title) WARN_UNUSED_RESULT; + const std::string& title) WARN_UNUSED_RESULT; // Creates a favicon of |color| with image reps of the platform's supported // scale factors (eg MacOS) in addition to 1x. @@ -191,16 +191,16 @@ gfx::Image Create1xFaviconFromPNGFile(const std::string& path); std::string IndexedURL(int i); // Returns a URL title identifiable by |i|. -std::wstring IndexedURLTitle(int i); +std::string IndexedURLTitle(int i); // Returns a folder name identifiable by |i|. -std::wstring IndexedFolderName(int i); +std::string IndexedFolderName(int i); // Returns a subfolder name identifiable by |i|. -std::wstring IndexedSubfolderName(int i); +std::string IndexedSubfolderName(int i); // Returns a subsubfolder name identifiable by |i|. -std::wstring IndexedSubsubfolderName(int i); +std::string IndexedSubsubfolderName(int i); } // namespace bookmarks_helper diff --git a/chrome/browser/sync/test/integration/cross_platform_sync_test.cc b/chrome/browser/sync/test/integration/cross_platform_sync_test.cc index 6b7ab9e..1bc2b27 100644 --- a/chrome/browser/sync/test/integration/cross_platform_sync_test.cc +++ b/chrome/browser/sync/test/integration/cross_platform_sync_test.cc @@ -27,7 +27,7 @@ class CrossPlatformSyncTest : public SyncTest { IN_PROC_BROWSER_TEST_F(CrossPlatformSyncTest, DISABLED_AddBookmark) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; - ASSERT_TRUE(AddURL(0, L"Google", GURL("http://www.google.co.uk"))); + ASSERT_TRUE(AddURL(0, "Google", GURL("http://www.google.co.uk"))); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); ASSERT_TRUE(ModelMatchesVerifier(0)); } diff --git a/chrome/browser/sync/test/integration/multiple_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/multiple_client_bookmarks_sync_test.cc index 9730c79..45a7b71 100644 --- a/chrome/browser/sync/test/integration/multiple_client_bookmarks_sync_test.cc +++ b/chrome/browser/sync/test/integration/multiple_client_bookmarks_sync_test.cc @@ -27,7 +27,7 @@ IN_PROC_BROWSER_TEST_F(MultipleClientBookmarksSyncTest, Sanity) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; DisableVerifier(); for (int i = 0; i < num_clients(); ++i) { - ASSERT_TRUE(AddURL(i, base::StringPrintf(L"Google URL %d", i), + ASSERT_TRUE(AddURL(i, base::StringPrintf("Google URL %d", i), GURL(base::StringPrintf("http://www.google.com/%d", i))) != NULL); } ASSERT_TRUE(AwaitAllModelsMatch()); diff --git a/chrome/browser/sync/test/integration/performance/bookmarks_sync_perf_test.cc b/chrome/browser/sync/test/integration/performance/bookmarks_sync_perf_test.cc index 557e686..bf4dcf3 100644 --- a/chrome/browser/sync/test/integration/performance/bookmarks_sync_perf_test.cc +++ b/chrome/browser/sync/test/integration/performance/bookmarks_sync_perf_test.cc @@ -41,7 +41,7 @@ class BookmarksSyncPerfTest : public SyncTest { std::string NextIndexedURL(); // Returns a new unique bookmark title. - std::wstring NextIndexedURLTitle(); + std::string NextIndexedURLTitle(); int url_number_; int url_title_number_; @@ -79,7 +79,7 @@ std::string BookmarksSyncPerfTest::NextIndexedURL() { return IndexedURL(url_number_++); } -std::wstring BookmarksSyncPerfTest::NextIndexedURLTitle() { +std::string BookmarksSyncPerfTest::NextIndexedURLTitle() { return IndexedURLTitle(url_title_number_++); } diff --git a/chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc b/chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc new file mode 100644 index 0000000..3d60367 --- /dev/null +++ b/chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc @@ -0,0 +1,133 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/command_line.h" +#include "base/message_loop/message_loop.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/profile_sync_service.h" +#include "chrome/browser/sync/test/integration/bookmarks_helper.h" +#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" +#include "chrome/browser/sync/test/integration/sync_test.h" +#include "chrome/common/chrome_switches.h" +#include "components/bookmarks/browser/bookmark_model.h" +#include "sync/test/fake_server/fake_server_verifier.h" + +using bookmarks_helper::AddFolder; +using bookmarks_helper::AddURL; +using bookmarks_helper::GetOtherNode; +using bookmarks_helper::ModelMatchesVerifier; +using bookmarks_helper::Move; +using bookmarks_helper::Remove; +using sync_integration_test_util::AwaitCommitActivityCompletion; + +class SingleClientBackupRollbackTest : public SyncTest { + public: + SingleClientBackupRollbackTest() : SyncTest(SINGLE_CLIENT) {} + virtual ~SingleClientBackupRollbackTest() {} + + virtual void SetUp() OVERRIDE { + CommandLine::ForCurrentProcess()->AppendSwitch( + switches::kSyncEnableRollback); + SyncTest::SetUp(); + } + + private: + DISALLOW_COPY_AND_ASSIGN(SingleClientBackupRollbackTest); +}; + +class BackupModeChecker { + public: + explicit BackupModeChecker(ProfileSyncService* service, + base::TimeDelta timeout) + : pss_(service), + expiration_(base::TimeTicks::Now() + timeout) {} + + bool Wait() { + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&BackupModeChecker::PeriodicCheck, base::Unretained(this)), + base::TimeDelta::FromSeconds(1)); + base::MessageLoop::current()->Run(); + return IsBackupComplete(); + } + + private: + void PeriodicCheck() { + if (IsBackupComplete() || base::TimeTicks::Now() > expiration_) { + base::MessageLoop::current()->Quit(); + } else { + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind(&BackupModeChecker::PeriodicCheck, base::Unretained(this)), + base::TimeDelta::FromSeconds(1)); + } + } + + bool IsBackupComplete() { + return pss_->backend_mode() == ProfileSyncService::BACKUP && + pss_->ShouldPushChanges(); + } + + ProfileSyncService* pss_; + base::TimeTicks expiration_; +}; + +#if defined(OS_WIN) || defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) +#define MAYBE_TestBackupRollback TestBackupRollback +#else +#define MAYBE_TestBackupRollback DISABLED_TestBackupRollback +#endif +IN_PROC_BROWSER_TEST_F(SingleClientBackupRollbackTest, + MAYBE_TestBackupRollback) { + ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; + + // Starting state: + // other_node + // -> top + // -> tier1_a + // -> http://mail.google.com "tier1_a_url0" + // -> tier1_b + // -> http://www.nhl.com "tier1_b_url0" + const BookmarkNode* top = AddFolder(0, GetOtherNode(0), 0, "top"); + const BookmarkNode* tier1_a = AddFolder(0, top, 0, "tier1_a"); + const BookmarkNode* tier1_b = AddFolder(0, top, 1, "tier1_b"); + ASSERT_TRUE(AddURL(0, tier1_a, 0, "tier1_a_url0", + GURL("http://mail.google.com"))); + ASSERT_TRUE(AddURL(0, tier1_b, 0, "tier1_b_url0", + GURL("http://www.nhl.com"))); + + BackupModeChecker checker(GetSyncService(0), + base::TimeDelta::FromSeconds(15)); + ASSERT_TRUE(checker.Wait()); + + // Setup sync, wait for its completion, and make sure changes were synced. + ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; + ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); + ASSERT_TRUE(ModelMatchesVerifier(0)); + + // Made bookmark changes while sync is on. + Move(0, tier1_a->GetChild(0), tier1_b, 1); + Remove(0, tier1_b, 0); + ASSERT_TRUE(AddFolder(0, tier1_b, 1, "tier2_c")); + ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); + ASSERT_TRUE(ModelMatchesVerifier(0)); + + // Let server to return rollback command on next sync request. + GetFakeServer()->TriggerError(sync_pb::SyncEnums::USER_ROLLBACK); + + // Make another change to trigger downloading of rollback command. + Remove(0, tier1_b, 0); + + // Wait for sync to switch to backup mode after finishing rollback. + ASSERT_TRUE(checker.Wait()); + + // Verify bookmarks are restored. + ASSERT_EQ(1, tier1_a->child_count()); + const BookmarkNode* url1 = tier1_a->GetChild(0); + ASSERT_EQ(GURL("http://mail.google.com"), url1->url()); + + ASSERT_EQ(1, tier1_b->child_count()); + const BookmarkNode* url2 = tier1_b->GetChild(0); + ASSERT_EQ(GURL("http://www.nhl.com"), url2->url()); +} diff --git a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc index 218c10c..15d661c 100644 --- a/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_bookmarks_sync_test.cc @@ -78,17 +78,17 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { // -> http://www.facebook.com "tier1_a_url2" // -> tier1_b // -> http://www.nhl.com "tier1_b_url0" - const BookmarkNode* top = AddFolder(0, GetOtherNode(0), 0, L"top"); - const BookmarkNode* tier1_a = AddFolder(0, top, 0, L"tier1_a"); - const BookmarkNode* tier1_b = AddFolder(0, top, 1, L"tier1_b"); + const BookmarkNode* top = AddFolder(0, GetOtherNode(0), 0, "top"); + const BookmarkNode* tier1_a = AddFolder(0, top, 0, "tier1_a"); + const BookmarkNode* tier1_b = AddFolder(0, top, 1, "tier1_b"); const BookmarkNode* tier1_a_url0 = AddURL( - 0, tier1_a, 0, L"tier1_a_url0", GURL("http://mail.google.com")); + 0, tier1_a, 0, "tier1_a_url0", GURL("http://mail.google.com")); const BookmarkNode* tier1_a_url1 = AddURL( - 0, tier1_a, 1, L"tier1_a_url1", GURL("http://www.pandora.com")); + 0, tier1_a, 1, "tier1_a_url1", GURL("http://www.pandora.com")); const BookmarkNode* tier1_a_url2 = AddURL( - 0, tier1_a, 2, L"tier1_a_url2", GURL("http://www.facebook.com")); + 0, tier1_a, 2, "tier1_a_url2", GURL("http://www.facebook.com")); const BookmarkNode* tier1_b_url0 = AddURL( - 0, tier1_b, 0, L"tier1_b_url0", GURL("http://www.nhl.com")); + 0, tier1_b, 0, "tier1_b_url0", GURL("http://www.nhl.com")); // Setup sync, wait for its completion, and make sure changes were synced. ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; @@ -117,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { // -> Wynn (www.wynnlasvegas.com) // -> tier1_a_url0 const BookmarkNode* bar = GetBookmarkBarNode(0); - const BookmarkNode* cnn = AddURL(0, bar, 0, L"CNN", + const BookmarkNode* cnn = AddURL(0, bar, 0, "CNN", GURL("http://www.cnn.com")); ASSERT_TRUE(cnn != NULL); Move(0, tier1_a, bar, 1); @@ -126,7 +126,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); ASSERT_TRUE(ModelMatchesVerifier(0)); - const BookmarkNode* porsche = AddURL(0, bar, 2, L"Porsche", + const BookmarkNode* porsche = AddURL(0, bar, 2, "Porsche", GURL("http://www.porsche.com")); // Rearrange stuff in tier1_a. ASSERT_EQ(tier1_a, tier1_a_url2->parent()); @@ -141,21 +141,21 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { ASSERT_EQ(1, tier1_a_url0->parent()->GetIndexOf(tier1_a_url0)); Move(0, tier1_a_url0, bar, bar->child_count()); const BookmarkNode* boa = AddURL(0, bar, bar->child_count(), - L"Bank of America", GURL("https://www.bankofamerica.com")); + "Bank of America", GURL("https://www.bankofamerica.com")); ASSERT_TRUE(boa != NULL); Move(0, tier1_a_url0, top, top->child_count()); const BookmarkNode* bubble = AddURL( - 0, bar, bar->child_count(), L"Seattle Bubble", + 0, bar, bar->child_count(), "Seattle Bubble", GURL("http://seattlebubble.com")); ASSERT_TRUE(bubble != NULL); - const BookmarkNode* wired = AddURL(0, bar, 2, L"Wired News", + const BookmarkNode* wired = AddURL(0, bar, 2, "Wired News", GURL("http://www.wired.com")); const BookmarkNode* tier2_b = AddFolder( - 0, tier1_b, 0, L"tier2_b"); + 0, tier1_b, 0, "tier2_b"); Move(0, tier1_b_url0, tier2_b, 0); Move(0, porsche, bar, 0); - SetTitle(0, wired, L"News Wired"); - SetTitle(0, porsche, L"ICanHazPorsche?"); + SetTitle(0, wired, "News Wired"); + SetTitle(0, porsche, "ICanHazPorsche?"); // Wait for the title change to sync. ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); @@ -165,10 +165,10 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, Sanity) { Remove(0, top, top->child_count() - 1); Move(0, wired, tier1_b, 0); Move(0, porsche, bar, 3); - const BookmarkNode* tier3_b = AddFolder(0, tier2_b, 1, L"tier3_b"); + const BookmarkNode* tier3_b = AddFolder(0, tier2_b, 1, "tier3_b"); const BookmarkNode* leafs = AddURL( - 0, tier1_a, 0, L"Toronto Maple Leafs", GURL("http://mapleleafs.nhl.com")); - const BookmarkNode* wynn = AddURL(0, bar, 1, L"Wynn", + 0, tier1_a, 0, "Toronto Maple Leafs", GURL("http://mapleleafs.nhl.com")); + const BookmarkNode* wynn = AddURL(0, bar, 1, "Wynn", GURL("http://www.wynnlasvegas.com")); Move(0, wynn, tier3_b, 0); @@ -197,7 +197,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, InjectedBookmark) { ASSERT_TRUE(SetupClients()); ASSERT_TRUE(SetupSync()); - ASSERT_EQ(1, CountBookmarksWithTitlesMatching(0, base::UTF8ToWide(title))); + ASSERT_EQ(1, CountBookmarksWithTitlesMatching(0, title)); } // Test that a client doesn't mutate the favicon data in the process @@ -218,7 +218,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, const GURL page_url("http://www.google.com"); const GURL icon_url("http://www.google.com/favicon.ico"); - const BookmarkNode* bookmark = AddURL(0, L"title", page_url); + const BookmarkNode* bookmark = AddURL(0, "title", page_url); // Simulate receiving a favicon from sync encoded by a different PNG encoder // than the one native to the OS. This tests the PNG data is not decoded to @@ -262,21 +262,21 @@ IN_PROC_BROWSER_TEST_F(SingleClientBookmarksSyncTest, // -> http://yahoo.com // -> http://gmail.com - const BookmarkNode* folder0 = AddFolder(0, GetOtherNode(0), 0, L"folder0"); - const BookmarkNode* tier1_a = AddFolder(0, folder0, 0, L"tier1_a"); - ASSERT_TRUE(AddURL(0, folder0, 1, L"News", GURL("http://news.google.com"))); - ASSERT_TRUE(AddURL(0, folder0, 2, L"Yahoo", GURL("http://www.yahoo.com"))); - ASSERT_TRUE(AddURL(0, tier1_a, 0, L"Gmail", GURL("http://mail.google.com"))); - ASSERT_TRUE(AddURL(0, tier1_a, 1, L"Google", GURL("http://www.google.com"))); + const BookmarkNode* folder0 = AddFolder(0, GetOtherNode(0), 0, "folder0"); + const BookmarkNode* tier1_a = AddFolder(0, folder0, 0, "tier1_a"); + ASSERT_TRUE(AddURL(0, folder0, 1, "News", GURL("http://news.google.com"))); + ASSERT_TRUE(AddURL(0, folder0, 2, "Yahoo", GURL("http://www.yahoo.com"))); + ASSERT_TRUE(AddURL(0, tier1_a, 0, "Gmai", GURL("http://mail.google.com"))); + ASSERT_TRUE(AddURL(0, tier1_a, 1, "Google", GURL("http://www.google.com"))); ASSERT_TRUE( - AddURL(0, GetOtherNode(0), 1, L"CNN", GURL("http://www.cnn.com"))); + AddURL(0, GetOtherNode(0), 1, "CNN", GURL("http://www.cnn.com"))); - ASSERT_TRUE(AddFolder(0, GetBookmarkBarNode(0), 0, L"empty_folder")); + ASSERT_TRUE(AddFolder(0, GetBookmarkBarNode(0), 0, "empty_folder")); const BookmarkNode* folder1 = - AddFolder(0, GetBookmarkBarNode(0), 1, L"folder1"); - ASSERT_TRUE(AddURL(0, folder1, 0, L"Yahoo", GURL("http://www.yahoo.com"))); + AddFolder(0, GetBookmarkBarNode(0), 1, "folder1"); + ASSERT_TRUE(AddURL(0, folder1, 0, "Yahoo", GURL("http://www.yahoo.com"))); ASSERT_TRUE( - AddURL(0, GetBookmarkBarNode(0), 2, L"Gmail", GURL("http://gmail.com"))); + AddURL(0, GetBookmarkBarNode(0), 2, "Gmai", GURL("http://gmail.com"))); // Set up sync, wait for its completion and verify that changes propagated. ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; diff --git a/chrome/browser/sync/test/integration/sync_auth_test.cc b/chrome/browser/sync/test/integration/sync_auth_test.cc index 1ead3a6..c4bf4e7 100644 --- a/chrome/browser/sync/test/integration/sync_auth_test.cc +++ b/chrome/browser/sync/test/integration/sync_auth_test.cc @@ -80,7 +80,7 @@ class SyncAuthTest : public SyncTest { // error, false if the bookmark is committed successfully. bool AttemptToTriggerAuthError() { int bookmark_index = GetNextBookmarkIndex(); - std::wstring title = base::StringPrintf(L"Bookmark %d", bookmark_index); + std::string title = base::StringPrintf("Bookmark %d", bookmark_index); GURL url = GURL(base::StringPrintf("http://www.foo%d.com", bookmark_index)); EXPECT_TRUE(AddURL(0, title, url) != NULL); diff --git a/chrome/browser/sync/test/integration/sync_errors_test.cc b/chrome/browser/sync/test/integration/sync_errors_test.cc index 7375bff..6d4e64e 100644 --- a/chrome/browser/sync/test/integration/sync_errors_test.cc +++ b/chrome/browser/sync/test/integration/sync_errors_test.cc @@ -91,22 +91,22 @@ IN_PROC_BROWSER_TEST_F(SyncErrorTest, BirthdayErrorTest) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; // Add an item, wait for sync, and trigger a birthday error on the server. - const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); - SetTitle(0, node1, L"new_title1"); + const BookmarkNode* node1 = AddFolder(0, 0, "title1"); + SetTitle(0, node1, "new_title1"); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); ASSERT_TRUE(GetFakeServer()->SetNewStoreBirthday("new store birthday")); // Now make one more change so we will do another sync. - const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); - SetTitle(0, node2, L"new_title2"); + const BookmarkNode* node2 = AddFolder(0, 0, "title2"); + SetTitle(0, node2, "new_title2"); ASSERT_TRUE(AwaitSyncDisabled(GetSyncService((0)))); } IN_PROC_BROWSER_TEST_F(LegacySyncErrorTest, ActionableErrorTest) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; - const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); - SetTitle(0, node1, L"new_title1"); + const BookmarkNode* node1 = AddFolder(0, 0, "title1"); + SetTitle(0, node1, "new_title1"); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); syncer::SyncProtocolError protocol_error; @@ -117,8 +117,8 @@ IN_PROC_BROWSER_TEST_F(LegacySyncErrorTest, ActionableErrorTest) { TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS); // Now make one more change so we will do another sync. - const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); - SetTitle(0, node2, L"new_title2"); + const BookmarkNode* node2 = AddFolder(0, 0, "title2"); + SetTitle(0, node2, "new_title2"); // Wait until an actionable error is encountered. ActionableErrorChecker actionable_error_checker(GetSyncService((0))); @@ -169,8 +169,8 @@ IN_PROC_BROWSER_TEST_F(LegacySyncErrorTest, BirthdayErrorUsingActionableErrorTest) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; - const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); - SetTitle(0, node1, L"new_title1"); + const BookmarkNode* node1 = AddFolder(0, 0, "title1"); + SetTitle(0, node1, "new_title1"); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); syncer::SyncProtocolError protocol_error; @@ -181,8 +181,8 @@ IN_PROC_BROWSER_TEST_F(LegacySyncErrorTest, TriggerSyncError(protocol_error, SyncTest::ERROR_FREQUENCY_ALWAYS); // Now make one more change so we will do another sync. - const BookmarkNode* node2 = AddFolder(0, 0, L"title2"); - SetTitle(0, node2, L"new_title2"); + const BookmarkNode* node2 = AddFolder(0, 0, "title2"); + SetTitle(0, node2, "new_title2"); ASSERT_TRUE(AwaitSyncDisabled(GetSyncService((0)))); ProfileSyncService::Status status; GetSyncService((0))->QueryDetailedSyncStatus(&status); @@ -206,8 +206,8 @@ IN_PROC_BROWSER_TEST_F(LegacySyncErrorTest, synced_datatypes = GetSyncService((0))->GetPreferredDataTypes(); ASSERT_FALSE(synced_datatypes.Has(syncer::TYPED_URLS)); - const BookmarkNode* node1 = AddFolder(0, 0, L"title1"); - SetTitle(0, node1, L"new_title1"); + const BookmarkNode* node1 = AddFolder(0, 0, "title1"); + SetTitle(0, node1, "new_title1"); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); // TODO(lipalani)" Verify initial sync ended for typed url is false. } diff --git a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc index 7a312e1..c5ddd0c 100644 --- a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc +++ b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc @@ -67,14 +67,14 @@ IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, OfflineToOnline) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; // Add an item and ensure that sync is successful. - ASSERT_TRUE(AddFolder(0, 0, L"folder1")); + ASSERT_TRUE(AddFolder(0, 0, "folder1")); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); // Trigger a network error at the client side. DisableNetwork(GetProfile(0)); // Add a new item to trigger another sync cycle. - ASSERT_TRUE(AddFolder(0, 0, L"folder2")); + ASSERT_TRUE(AddFolder(0, 0, "folder2")); // Verify that the client goes into exponential backoff while it is unable to // reach the sync server. @@ -95,14 +95,14 @@ IN_PROC_BROWSER_TEST_F(SyncExponentialBackoffTest, TransientErrorTest) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; // Add an item and ensure that sync is successful. - ASSERT_TRUE(AddFolder(0, 0, L"folder1")); + ASSERT_TRUE(AddFolder(0, 0, "folder1")); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); // Trigger a transient error on the server. TriggerTransientError(); // Add a new item to trigger another sync cycle. - ASSERT_TRUE(AddFolder(0, 0, L"folder2")); + ASSERT_TRUE(AddFolder(0, 0, "folder2")); // Verify that the client goes into exponential backoff while it is unable to // reach the sync server. diff --git a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc index 2b3e38a..7fb554c 100644 --- a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc @@ -44,10 +44,10 @@ using sync_integration_test_util::AwaitPassphraseAccepted; using sync_integration_test_util::AwaitPassphraseRequired; const std::string kGenericURL = "http://www.host.ext:1234/path/filename"; -const std::wstring kGenericURLTitle = L"URL Title"; -const std::wstring kGenericFolderName = L"Folder Name"; -const std::wstring kGenericSubfolderName = L"Subfolder Name"; -const std::wstring kGenericSubsubfolderName = L"Subsubfolder Name"; +const std::string kGenericURLTitle = "URL Title"; +const std::string kGenericFolderName = "Folder Name"; +const std::string kGenericSubfolderName = "Subfolder Name"; +const std::string kGenericSubsubfolderName = "Subsubfolder Name"; const char* kValidPassphrase = "passphrase!"; class TwoClientBookmarksSyncTest : public SyncTest { @@ -73,21 +73,21 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, Sanity) { ASSERT_TRUE(AllModelsMatchVerifier()); GURL google_url("http://www.google.com"); - ASSERT_TRUE(AddURL(0, L"Google", google_url) != NULL); + ASSERT_TRUE(AddURL(0, "Google", google_url) != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); - ASSERT_TRUE(AddURL(1, L"Yahoo", GURL("http://www.yahoo.com")) != NULL); + ASSERT_TRUE(AddURL(1, "Yahoo", GURL("http://www.yahoo.com")) != NULL); ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); ASSERT_TRUE(AllModelsMatchVerifier()); - const BookmarkNode* new_folder = AddFolder(0, 2, L"New Folder"); + const BookmarkNode* new_folder = AddFolder(0, 2, "New Folder"); Move(0, GetUniqueNodeByURL(0, google_url), new_folder, 0); - SetTitle(0, GetBookmarkBarNode(0)->GetChild(0), L"Yahoo!!"); - ASSERT_TRUE(AddURL(0, GetBookmarkBarNode(0), 1, L"CNN", + SetTitle(0, GetBookmarkBarNode(0)->GetChild(0), "Yahoo!!"); + ASSERT_TRUE(AddURL(0, GetBookmarkBarNode(0), 1, "CNN", GURL("http://www.cnn.com")) != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); - ASSERT_TRUE(AddURL(1, L"Facebook", GURL("http://www.facebook.com")) != NULL); + ASSERT_TRUE(AddURL(1, "Facebook", GURL("http://www.facebook.com")) != NULL); ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); ASSERT_TRUE(AllModelsMatchVerifier()); @@ -96,8 +96,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, Sanity) { ASSERT_TRUE(AllModelsMatchVerifier()); DisableVerifier(); - SetTitle(0, GetUniqueNodeByURL(0, google_url), L"Google++"); - SetTitle(1, GetUniqueNodeByURL(1, google_url), L"Google--"); + SetTitle(0, GetUniqueNodeByURL(0, google_url), "Google++"); + SetTitle(1, GetUniqueNodeByURL(1, google_url), "Google--"); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllModelsMatch()); } @@ -109,7 +109,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SimultaneousURLChanges) { GURL initial_url("http://www.google.com"); GURL second_url("http://www.google.com/abc"); GURL third_url("http://www.google.com/def"); - std::wstring title = L"Google"; + std::string title = "Google"; ASSERT_TRUE(AddURL(0, title, initial_url) != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); @@ -122,7 +122,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SimultaneousURLChanges) { ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllModelsMatch()); - SetTitle(0, GetBookmarkBarNode(0)->GetChild(0), L"Google1"); + SetTitle(0, GetBookmarkBarNode(0)->GetChild(0), "Google1"); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatch()); } @@ -213,8 +213,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddNonHTTPBMs) { ASSERT_TRUE(AllModelsMatchVerifier()); ASSERT_TRUE(AddURL( - 0, L"FTP URL", GURL("ftp://user:password@host:1234/path")) != NULL); - ASSERT_TRUE(AddURL(0, L"File URL", GURL("file://host/path")) != NULL); + 0, "FTP UR", GURL("ftp://user:password@host:1234/path")) != NULL); + ASSERT_TRUE(AddURL(0, "File UR", GURL("file://host/path")) != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); } @@ -240,7 +240,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(AllModelsMatchVerifier()); for (int i = 0; i < 20; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); ASSERT_TRUE(AddURL( @@ -258,16 +258,16 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, for (int i = 0; i < 15; ++i) { if (base::RandDouble() > 0.6) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } else { - std::wstring title = IndexedFolderName(i); + std::string title = IndexedFolderName(i); const BookmarkNode* folder = AddFolder(0, i, title); ASSERT_TRUE(folder != NULL); if (base::RandDouble() > 0.4) { for (int i = 0; i < 20; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE( AddURL(0, folder, i, title, url) != NULL); @@ -276,7 +276,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, } } for (int i = 0; i < 10; i++) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, GetOtherNode(0), i, title, url) != NULL); } @@ -304,8 +304,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring title0 = IndexedURLTitle(0); - std::wstring title1 = IndexedURLTitle(1); + std::string title0 = IndexedURLTitle(0); + std::string title1 = IndexedURLTitle(1); ASSERT_TRUE(AddURL(0, title0, GURL(kGenericURL)) != NULL); ASSERT_TRUE(AddURL(0, title1, GURL(kGenericURL)) != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); @@ -317,13 +317,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameBMName) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring title = IndexedURLTitle(1); + std::string title = IndexedURLTitle(1); const BookmarkNode* bookmark = AddURL(0, title, GURL(kGenericURL)); ASSERT_TRUE(bookmark != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring new_title = IndexedURLTitle(2); + std::string new_title = IndexedURLTitle(2); SetTitle(0, bookmark, new_title); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); @@ -353,13 +353,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring title = IndexedURLTitle(1); + std::string title = IndexedURLTitle(1); const BookmarkNode* bookmark = AddURL(0, title, GURL(kGenericURL)); ASSERT_TRUE(bookmark != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring new_title = IndexedURLTitle(2); + std::string new_title = IndexedURLTitle(2); SetTitle(0, bookmark, new_title); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); @@ -396,14 +396,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameBMFolder) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring title = IndexedFolderName(1); + std::string title = IndexedFolderName(1); const BookmarkNode* folder = AddFolder(0, title); ASSERT_TRUE(AddURL( 0, folder, 0, kGenericURLTitle, GURL(kGenericURL)) != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring new_title = IndexedFolderName(2); + std::string new_title = IndexedFolderName(2); SetTitle(0, folder, new_title); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); @@ -414,12 +414,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameEmptyBMFolder) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring title = IndexedFolderName(1); + std::string title = IndexedFolderName(1); const BookmarkNode* folder = AddFolder(0, title); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring new_title = IndexedFolderName(2); + std::string new_title = IndexedFolderName(2); SetTitle(0, folder, new_title); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); @@ -431,23 +431,23 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring title = IndexedFolderName(1); + std::string title = IndexedFolderName(1); const BookmarkNode* folder = AddFolder(0, title); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 120; ++i) { if (base::RandDouble() > 0.15) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } else { - std::wstring title = IndexedSubfolderName(i); + std::string title = IndexedSubfolderName(i); ASSERT_TRUE(AddFolder(0, folder, i, title) != NULL); } } ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring new_title = IndexedFolderName(2); + std::string new_title = IndexedFolderName(2); SetTitle(0, folder, new_title); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); @@ -462,26 +462,26 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 1; i < 15; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } - std::wstring title = IndexedSubfolderName(1); + std::string title = IndexedSubfolderName(1); const BookmarkNode* subfolder = AddFolder(0, folder, 0, title); for (int i = 0; i < 120; ++i) { if (base::RandDouble() > 0.15) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, subfolder, i, title, url) != NULL); } else { - std::wstring title = IndexedSubsubfolderName(i); + std::string title = IndexedSubsubfolderName(i); ASSERT_TRUE(AddFolder(0, subfolder, i, title) != NULL); } } ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); - std::wstring new_title = IndexedSubfolderName(2); + std::string new_title = IndexedSubfolderName(2); SetTitle(0, subfolder, new_title); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); @@ -493,14 +493,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_RenameBMNameAndURL) { ASSERT_TRUE(AllModelsMatchVerifier()); GURL url = GURL(IndexedURL(1)); - std::wstring title = IndexedURLTitle(1); + std::string title = IndexedURLTitle(1); const BookmarkNode* bookmark = AddURL(0, title, url); ASSERT_TRUE(bookmark != NULL); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatchVerifier()); GURL new_url = GURL(IndexedURL(2)); - std::wstring new_title = IndexedURLTitle(2); + std::string new_title = IndexedURLTitle(2); bookmark = SetURL(0, bookmark, new_url); ASSERT_TRUE(bookmark != NULL); SetTitle(0, bookmark, new_title); @@ -531,7 +531,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(AllModelsMatchVerifier()); for (int i = 0; i < 20; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } @@ -552,7 +552,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -573,7 +573,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -594,7 +594,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -615,7 +615,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -654,11 +654,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(AddFolder(0, kGenericFolderName) != NULL); for (int i = 1; i < 15; ++i) { if (base::RandDouble() > 0.6) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } else { - std::wstring title = IndexedFolderName(i); + std::string title = IndexedFolderName(i); ASSERT_TRUE(AddFolder(0, i, title) != NULL); } } @@ -681,16 +681,16 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(folder != NULL); for (int i = 2; i < 10; ++i) { if (base::RandDouble() > 0.6) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } else { - std::wstring title = IndexedFolderName(i); + std::string title = IndexedFolderName(i); ASSERT_TRUE(AddFolder(0, i, title) != NULL); } } for (int i = 0; i < 15; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -713,33 +713,33 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(folder != NULL); for (int i = 2; i < 10; ++i) { if (base::RandDouble() > 0.6) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } else { - std::wstring title = IndexedFolderName(i); + std::string title = IndexedFolderName(i); ASSERT_TRUE(AddFolder(0, i, title) != NULL); } } for (int i = 0; i < 10; ++i) { if (base::RandDouble() > 0.6) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } else { - std::wstring title = IndexedSubfolderName(i); + std::string title = IndexedSubfolderName(i); const BookmarkNode* subfolder = AddFolder(0, folder, i, title); ASSERT_TRUE(subfolder != NULL); if (base::RandDouble() > 0.3) { for (int j = 0; j < 10; ++j) { if (base::RandDouble() > 0.6) { - std::wstring title = IndexedURLTitle(j); + std::string title = IndexedURLTitle(j); GURL url = GURL(IndexedURL(j)); ASSERT_TRUE(AddURL( 0, subfolder, j, title, url) != NULL); } else { - std::wstring title = IndexedSubsubfolderName(j); + std::string title = IndexedSubsubfolderName(j); ASSERT_TRUE(AddFolder( 0, subfolder, j, title) != NULL); } @@ -764,7 +764,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 1; i < 11; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } @@ -773,11 +773,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(subfolder != NULL); for (int i = 0; i < 30; ++i) { if (base::RandDouble() > 0.2) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, subfolder, i, title, url) != NULL); } else { - std::wstring title = IndexedSubsubfolderName(i); + std::string title = IndexedSubsubfolderName(i); ASSERT_TRUE(AddFolder(0, subfolder, i, title) != NULL); } } @@ -797,8 +797,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, GURL url0 = GURL(IndexedURL(0)); GURL url1 = GURL(IndexedURL(1)); - std::wstring title0 = IndexedURLTitle(0); - std::wstring title1 = IndexedURLTitle(1); + std::string title0 = IndexedURLTitle(0); + std::string title1 = IndexedURLTitle(1); const BookmarkNode* bookmark0 = AddURL(0, 0, title0, url0); const BookmarkNode* bookmark1 = AddURL(0, 1, title1, url1); ASSERT_TRUE(bookmark0 != NULL); @@ -817,7 +817,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_ReverseTheOrderOf10BMs) { ASSERT_TRUE(AllModelsMatchVerifier()); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } @@ -839,7 +839,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, 1, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 2; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } @@ -866,7 +866,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, 1, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -890,7 +890,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -898,7 +898,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, AddFolder(0, folder, 3, kGenericSubfolderName); ASSERT_TRUE(subfolder != NULL); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i + 3); + std::string title = IndexedURLTitle(i + 3); GURL url = GURL(IndexedURL(i + 3)); ASSERT_TRUE(AddURL(0, subfolder, i, title, url) != NULL); } @@ -922,7 +922,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -930,7 +930,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, AddFolder(0, folder, 3, kGenericSubfolderName); ASSERT_TRUE(subfolder != NULL); for (int i = 0; i < 5; ++i) { - std::wstring title = IndexedURLTitle(i + 3); + std::string title = IndexedURLTitle(i + 3); GURL url = GURL(IndexedURL(i + 3)); ASSERT_TRUE(AddURL(0, subfolder, i, title, url) != NULL); } @@ -956,18 +956,18 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_HoistBMs10LevelUp) { for (int level = 0; level < 15; ++level) { int num_bookmarks = base::RandInt(0, 9); for (int i = 0; i < num_bookmarks; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } - std::wstring title = IndexedFolderName(level); + std::string title = IndexedFolderName(level); folder = AddFolder(0, folder, folder->child_count(), title); ASSERT_TRUE(folder != NULL); if (level == 0) folder_L0 = folder; if (level == 10) folder_L10 = folder; } for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i + 10); + std::string title = IndexedURLTitle(i + 10); GURL url = GURL(IndexedURL(i + 10)); ASSERT_TRUE(AddURL(0, folder_L10, i, title, url) != NULL); } @@ -997,18 +997,18 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_SinkBMs10LevelDown) { for (int level = 0; level < 15; ++level) { int num_bookmarks = base::RandInt(0, 9); for (int i = 0; i < num_bookmarks; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } - std::wstring title = IndexedFolderName(level); + std::string title = IndexedFolderName(level); folder = AddFolder(0, folder, folder->child_count(), title); ASSERT_TRUE(folder != NULL); if (level == 0) folder_L0 = folder; if (level == 10) folder_L10 = folder; } for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i + 10); + std::string title = IndexedURLTitle(i + 10); GURL url = GURL(IndexedURL(i + 10)); ASSERT_TRUE(AddURL(0, folder_L0, 0, title, url) != NULL); } @@ -1036,11 +1036,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, for (int level = 0; level < 15; ++level) { int num_bookmarks = base::RandInt(0, 9); for (int i = 0; i < num_bookmarks; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } - std::wstring title = IndexedFolderName(level); + std::string title = IndexedFolderName(level); folder = AddFolder( 0, folder, folder->child_count(), title); ASSERT_TRUE(folder != NULL); @@ -1068,11 +1068,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, for (int level = 0; level < 6; ++level) { int num_bookmarks = base::RandInt(0, 9); for (int i = 0; i < num_bookmarks; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } - std::wstring title = IndexedFolderName(level); + std::string title = IndexedFolderName(level); folder = AddFolder(0, folder, folder->child_count(), title); ASSERT_TRUE(folder != NULL); if (level == 5) folder_L5 = folder; @@ -1081,7 +1081,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, 0, GetBookmarkBarNode(0)->child_count(), kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -1104,11 +1104,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, for (int level = 0; level < 6; ++level) { int num_bookmarks = base::RandInt(0, 9); for (int i = 0; i < num_bookmarks; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } - std::wstring title = IndexedFolderName(level); + std::string title = IndexedFolderName(level); folder = AddFolder( 0, folder, folder->child_count(), title); ASSERT_TRUE(folder != NULL); @@ -1118,7 +1118,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, 0, folder_L5, folder_L5->child_count(), kGenericFolderName); ASSERT_TRUE(folder != NULL); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder, i, title, url) != NULL); } @@ -1137,11 +1137,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(AllModelsMatchVerifier()); for (int i = 0; i < 2; ++i) { - std::wstring title = IndexedFolderName(i); + std::string title = IndexedFolderName(i); const BookmarkNode* folder = AddFolder(0, i, title); ASSERT_TRUE(folder != NULL); for (int j = 0; j < 10; ++j) { - std::wstring title = IndexedURLTitle(j); + std::string title = IndexedURLTitle(j); GURL url = GURL(IndexedURL(j)); ASSERT_TRUE(AddURL(0, folder, j, title, url) != NULL); } @@ -1161,11 +1161,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(AllModelsMatchVerifier()); for (int i = 0; i < 10; ++i) { - std::wstring title = IndexedFolderName(i); + std::string title = IndexedFolderName(i); const BookmarkNode* folder = AddFolder(0, i, title); ASSERT_TRUE(folder != NULL); for (int j = 0; j < 10; ++j) { - std::wstring title = IndexedURLTitle(1000 * i + j); + std::string title = IndexedURLTitle(1000 * i + j); GURL url = GURL(IndexedURL(j)); ASSERT_TRUE(AddURL(0, folder, j, title, url) != NULL); } @@ -1186,10 +1186,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableVerifier(); for (int i = 0; i < 2; ++i) { - std::wstring title0 = IndexedURLTitle(2*i); + std::string title0 = IndexedURLTitle(2*i); GURL url0 = GURL(IndexedURL(2*i)); ASSERT_TRUE(AddURL(0, title0, url0) != NULL); - std::wstring title1 = IndexedURLTitle(2*i+1); + std::string title1 = IndexedURLTitle(2*i+1); GURL url1 = GURL(IndexedURL(2*i+1)); ASSERT_TRUE(AddURL(1, title1, url1) != NULL); } @@ -1208,7 +1208,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, // for duplicates to exist after sync completes. See http://crbug.com/19769. DisableVerifier(); for (int i = 0; i < 2; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, title, url) != NULL); ASSERT_TRUE(AddURL(1, title, url) != NULL); @@ -1231,17 +1231,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(SetupClients()) << "SetupClients() failed."; DisableVerifier(); - const BookmarkNode* folder0 = AddFolder(0, L"Folder"); + const BookmarkNode* folder0 = AddFolder(0, "Folder"); ASSERT_TRUE(folder0 != NULL); - ASSERT_TRUE(AddURL(0, folder0, 0, L"Bookmark 0", GURL(kGenericURL)) != NULL); - ASSERT_TRUE(AddURL(0, folder0, 1, L"Bookmark 1", GURL(kGenericURL)) != NULL); - ASSERT_TRUE(AddURL(0, folder0, 2, L"Bookmark 2", GURL(kGenericURL)) != NULL); + ASSERT_TRUE(AddURL(0, folder0, 0, "Bookmark 0", GURL(kGenericURL)) != NULL); + ASSERT_TRUE(AddURL(0, folder0, 1, "Bookmark 1", GURL(kGenericURL)) != NULL); + ASSERT_TRUE(AddURL(0, folder0, 2, "Bookmark 2", GURL(kGenericURL)) != NULL); - const BookmarkNode* folder1 = AddFolder(1, L"fOlDeR"); + const BookmarkNode* folder1 = AddFolder(1, "fOlDeR"); ASSERT_TRUE(folder1 != NULL); - ASSERT_TRUE(AddURL(1, folder1, 0, L"bOoKmArK 0", GURL(kGenericURL)) != NULL); - ASSERT_TRUE(AddURL(1, folder1, 1, L"BooKMarK 1", GURL(kGenericURL)) != NULL); - ASSERT_TRUE(AddURL(1, folder1, 2, L"bOOKMARK 2", GURL(kGenericURL)) != NULL); + ASSERT_TRUE(AddURL(1, folder1, 0, "bOoKmArK 0", GURL(kGenericURL)) != NULL); + ASSERT_TRUE(AddURL(1, folder1, 1, "BooKMarK 1", GURL(kGenericURL)) != NULL); + ASSERT_TRUE(AddURL(1, folder1, 2, "bOOKMARK 2", GURL(kGenericURL)) != NULL); ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(AwaitQuiescence()); @@ -1256,17 +1256,17 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableVerifier(); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); ASSERT_TRUE(AddURL(1, i, title, url) != NULL); } for (int i = 3; i < 10; ++i) { - std::wstring title0 = IndexedURLTitle(i); + std::string title0 = IndexedURLTitle(i); GURL url0 = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title0, url0) != NULL); - std::wstring title1 = IndexedURLTitle(i+7); + std::string title1 = IndexedURLTitle(i+7); GURL url1 = GURL(IndexedURL(i+7)); ASSERT_TRUE(AddURL(1, i, title1, url1) != NULL); } @@ -1284,14 +1284,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableVerifier(); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); ASSERT_TRUE(AddURL(1, i, title, url) != NULL); } for (int i = 3; i < 10; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(1, i, title, url) != NULL); } @@ -1309,7 +1309,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableVerifier(); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); ASSERT_TRUE(AddURL(1, i, title, url) != NULL); @@ -1332,10 +1332,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder1 = AddFolder(1, kGenericFolderName); ASSERT_TRUE(folder1 != NULL); for (int i = 0; i < 2; ++i) { - std::wstring title0 = IndexedURLTitle(2*i); + std::string title0 = IndexedURLTitle(2*i); GURL url0 = GURL(IndexedURL(2*i)); ASSERT_TRUE(AddURL(0, folder0, i, title0, url0) != NULL); - std::wstring title1 = IndexedURLTitle(2*i+1); + std::string title1 = IndexedURLTitle(2*i+1); GURL url1 = GURL(IndexedURL(2*i+1)); ASSERT_TRUE(AddURL(1, folder1, i, title1, url1) != NULL); } @@ -1352,31 +1352,31 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableVerifier(); for (int i = 0; i < 25; ++i) { - std::wstring title0 = IndexedURLTitle(i); + std::string title0 = IndexedURLTitle(i); GURL url0 = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title0, url0) != NULL); - std::wstring title1 = IndexedURLTitle(i+50); + std::string title1 = IndexedURLTitle(i+50); GURL url1 = GURL(IndexedURL(i+50)); ASSERT_TRUE(AddURL(1, i, title1, url1) != NULL); } for (int i = 25; i < 30; ++i) { - std::wstring title0 = IndexedFolderName(i); + std::string title0 = IndexedFolderName(i); const BookmarkNode* folder0 = AddFolder(0, i, title0); ASSERT_TRUE(folder0 != NULL); - std::wstring title1 = IndexedFolderName(i+50); + std::string title1 = IndexedFolderName(i+50); const BookmarkNode* folder1 = AddFolder(1, i, title1); ASSERT_TRUE(folder1 != NULL); for (int j = 0; j < 5; ++j) { - std::wstring title0 = IndexedURLTitle(i+5*j); + std::string title0 = IndexedURLTitle(i+5*j); GURL url0 = GURL(IndexedURL(i+5*j)); ASSERT_TRUE(AddURL(0, folder0, j, title0, url0) != NULL); - std::wstring title1 = IndexedURLTitle(i+5*j+50); + std::string title1 = IndexedURLTitle(i+5*j+50); GURL url1 = GURL(IndexedURL(i+5*j+50)); ASSERT_TRUE(AddURL(1, folder1, j, title1, url1) != NULL); } } for (int i = 100; i < 125; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, title, url) != NULL); ASSERT_TRUE(AddURL(1, title, url) != NULL); @@ -1398,11 +1398,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_TRUE(folder != NULL); for (int j = 0; j < 4; ++j) { if (base::RandDouble() < 0.5) { - std::wstring title = IndexedURLTitle(j); + std::string title = IndexedURLTitle(j); GURL url = GURL(IndexedURL(j)); ASSERT_TRUE(AddURL(i, folder, j, title, url) != NULL); } else { - std::wstring title = IndexedFolderName(j); + std::string title = IndexedFolderName(j); ASSERT_TRUE(AddFolder(i, folder, j, title) != NULL); } } @@ -1420,13 +1420,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableVerifier(); for (int i = 0; i < 4; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } for (int j = 0; j < 2; ++j) { - std::wstring title = IndexedURLTitle(j); + std::string title = IndexedURLTitle(j); GURL url = GURL(IndexedURL(j)); ASSERT_TRUE(AddURL(1, j, title, url) != NULL); } @@ -1509,13 +1509,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableVerifier(); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i+1); + std::string title = IndexedURLTitle(i+1); GURL url = GURL(IndexedURL(i+1)); ASSERT_TRUE(AddURL(0, i, title, url) != NULL); } for (int j = 0; j < 3; ++j) { - std::wstring title = IndexedURLTitle(j+4); + std::string title = IndexedURLTitle(j+4); GURL url = GURL(IndexedURL(j+4)); ASSERT_TRUE(AddURL(0, j, title, url) != NULL); } @@ -1536,7 +1536,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, int node_index = 0; for (int i = 1; i < 5 ; ++i) { for (int j = 0; j < i; ++j) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, node_index, title, url) != NULL); ++node_index; @@ -1544,7 +1544,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, } // Let's add a set of bookmarks {1,2,3,4} to client1. for (int i = 0; i < 4; ++i) { - std::wstring title = IndexedURLTitle(i+1); + std::string title = IndexedURLTitle(i+1); GURL url = GURL(IndexedURL(i+1)); ASSERT_TRUE(AddURL(1, i, title, url) != NULL); } @@ -1602,10 +1602,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, MC_DuplicateFolders) { const BookmarkNode* folder1 = AddFolder(1, kGenericFolderName); ASSERT_TRUE(folder1 != NULL); for (int i = 0; i < 5; ++i) { - std::wstring title0 = IndexedURLTitle(i); + std::string title0 = IndexedURLTitle(i); GURL url0 = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder0, i, title0, url0) != NULL); - std::wstring title1 = IndexedURLTitle(i+5); + std::string title1 = IndexedURLTitle(i+5); GURL url1 = GURL(IndexedURL(i+5)); ASSERT_TRUE(AddURL(1, folder1, i, title1, url1) != NULL); } @@ -1624,8 +1624,8 @@ IN_PROC_BROWSER_TEST_F(LegacyTwoClientBookmarksSyncTest, MC_DeleteBookmark) { const GURL bar_url("http://example.com/bar"); const GURL other_url("http://example.com/other"); - ASSERT_TRUE(AddURL(0, GetBookmarkBarNode(0), 0, L"bar", bar_url) != NULL); - ASSERT_TRUE(AddURL(0, GetOtherNode(0), 0, L"other", other_url) != NULL); + ASSERT_TRUE(AddURL(0, GetBookmarkBarNode(0), 0, "bar", bar_url) != NULL); + ASSERT_TRUE(AddURL(0, GetOtherNode(0), 0, "other", other_url) != NULL); ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); @@ -1658,7 +1658,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder0 = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder0 != NULL); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder0, i, title, url) != NULL); } @@ -1668,8 +1668,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, DisableVerifier(); GURL url(IndexedURL(0)); - SetTitle(0, GetUniqueNodeByURL(0, url), L"Title++"); - SetTitle(1, GetUniqueNodeByURL(1, url), L"Title--"); + SetTitle(0, GetUniqueNodeByURL(0, url), "Title++"); + SetTitle(1, GetUniqueNodeByURL(1, url), "Title--"); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllModelsMatch()); @@ -1685,7 +1685,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, const BookmarkNode* folder0 = AddFolder(0, kGenericFolderName); ASSERT_TRUE(folder0 != NULL); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folder0, i, title, url) != NULL); } @@ -1728,7 +1728,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, folderB[1] = AddFolder(1, IndexedFolderName(1)); ASSERT_TRUE(folderB[1] != NULL); for (int i = 0; i < 3; ++i) { - std::wstring title = IndexedURLTitle(i); + std::string title = IndexedURLTitle(i); GURL url = GURL(IndexedURL(i)); ASSERT_TRUE(AddURL(0, folderB[0], i, title, url) != NULL); } @@ -1739,11 +1739,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, folderC[1] = AddFolder(1, IndexedFolderName(2)); ASSERT_TRUE(folderC[1] != NULL); for (int i = 0; i < 3; ++i) { - std::wstring folder_name = IndexedSubfolderName(i); + std::string folder_name = IndexedSubfolderName(i); const BookmarkNode* subfolder = AddFolder(0, folderC[0], i, folder_name); ASSERT_TRUE(subfolder != NULL); for (int j = 0; j < 3; ++j) { - std::wstring title = IndexedURLTitle(j); + std::string title = IndexedURLTitle(j); GURL url = GURL(IndexedURL(j)); ASSERT_TRUE(AddURL(0, subfolder, j, title, url) != NULL); } @@ -1755,22 +1755,22 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, ASSERT_FALSE(ContainsDuplicateBookmarks(0)); // Simultaneously rename folder A on both clients. - SetTitle(0, folderA[0], L"Folder A++"); - SetTitle(1, folderA[1], L"Folder A--"); + SetTitle(0, folderA[0], "Folder A++"); + SetTitle(1, folderA[1], "Folder A--"); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllModelsMatch()); ASSERT_FALSE(ContainsDuplicateBookmarks(0)); // Simultaneously rename folder B on both clients. - SetTitle(0, folderB[0], L"Folder B++"); - SetTitle(1, folderB[1], L"Folder B--"); + SetTitle(0, folderB[0], "Folder B++"); + SetTitle(1, folderB[1], "Folder B--"); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllModelsMatch()); ASSERT_FALSE(ContainsDuplicateBookmarks(0)); // Simultaneously rename folder C on both clients. - SetTitle(0, folderC[0], L"Folder C++"); - SetTitle(1, folderC[1], L"Folder C--"); + SetTitle(0, folderC[0], "Folder C++"); + SetTitle(1, folderC[1], "Folder C--"); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllModelsMatch()); ASSERT_FALSE(ContainsDuplicateBookmarks(0)); @@ -1967,7 +1967,7 @@ IN_PROC_BROWSER_TEST_F(LegacyTwoClientBookmarksSyncTest, // Add a bookmark on Client 0 and ensure it syncs over. This will also trigger // both clients downloading the new Synced Bookmarks folder. - ASSERT_TRUE(AddURL(0, L"Google", GURL("http://www.google.com"))); + ASSERT_TRUE(AddURL(0, "Google", GURL("http://www.google.com"))); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllModelsMatch()); @@ -1975,7 +1975,7 @@ IN_PROC_BROWSER_TEST_F(LegacyTwoClientBookmarksSyncTest, // over. const BookmarkNode* synced_bookmarks = GetSyncedBookmarksNode(0); ASSERT_TRUE(synced_bookmarks); - ASSERT_TRUE(AddURL(0, synced_bookmarks, 0, L"Google2", + ASSERT_TRUE(AddURL(0, synced_bookmarks, 0, "Google2", GURL("http://www.google2.com"))); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllModelsMatch()); @@ -2002,21 +2002,21 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, // -> http://yahoo.com // -> http://gmail.com - const BookmarkNode* folder0 = AddFolder(0, GetOtherNode(0), 0, L"folder0"); - const BookmarkNode* tier1_a = AddFolder(0, folder0, 0, L"tier1_a"); - ASSERT_TRUE(AddURL(0, folder0, 1, L"News", GURL("http://news.google.com"))); - ASSERT_TRUE(AddURL(0, folder0, 2, L"Yahoo", GURL("http://www.yahoo.com"))); - ASSERT_TRUE(AddURL(0, tier1_a, 0, L"Gmail", GURL("http://mail.google.com"))); - ASSERT_TRUE(AddURL(0, tier1_a, 1, L"Google", GURL("http://www.google.com"))); + const BookmarkNode* folder0 = AddFolder(0, GetOtherNode(0), 0, "folder0"); + const BookmarkNode* tier1_a = AddFolder(0, folder0, 0, "tier1_a"); + ASSERT_TRUE(AddURL(0, folder0, 1, "News", GURL("http://news.google.com"))); + ASSERT_TRUE(AddURL(0, folder0, 2, "Yahoo", GURL("http://www.yahoo.com"))); + ASSERT_TRUE(AddURL(0, tier1_a, 0, "Gmai", GURL("http://mail.google.com"))); + ASSERT_TRUE(AddURL(0, tier1_a, 1, "Google", GURL("http://www.google.com"))); ASSERT_TRUE( - AddURL(0, GetOtherNode(0), 1, L"CNN", GURL("http://www.cnn.com"))); + AddURL(0, GetOtherNode(0), 1, "CNN", GURL("http://www.cnn.com"))); - ASSERT_TRUE(AddFolder(0, GetBookmarkBarNode(0), 0, L"empty_folder")); + ASSERT_TRUE(AddFolder(0, GetBookmarkBarNode(0), 0, "empty_folder")); const BookmarkNode* folder1 = - AddFolder(0, GetBookmarkBarNode(0), 1, L"folder1"); - ASSERT_TRUE(AddURL(0, folder1, 0, L"Yahoo", GURL("http://www.yahoo.com"))); + AddFolder(0, GetBookmarkBarNode(0), 1, "folder1"); + ASSERT_TRUE(AddURL(0, folder1, 0, "Yahoo", GURL("http://www.yahoo.com"))); ASSERT_TRUE( - AddURL(0, GetBookmarkBarNode(0), 2, L"Gmail", GURL("http://gmail.com"))); + AddURL(0, GetBookmarkBarNode(0), 2, "Gmai", GURL("http://gmail.com"))); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllModelsMatch()); diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index b3f0e3d..53ba705 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2378,6 +2378,7 @@ 'browser/sync/test/integration/sessions_helper.h', 'browser/sync/test/integration/single_client_app_list_sync_test.cc', 'browser/sync/test/integration/single_client_apps_sync_test.cc', + 'browser/sync/test/integration/single_client_backup_rollback_test.cc', 'browser/sync/test/integration/single_client_bookmarks_sync_test.cc', 'browser/sync/test/integration/single_client_dictionary_sync_test.cc', 'browser/sync/test/integration/single_client_extensions_sync_test.cc', diff --git a/sync/engine/sync_scheduler_impl.cc b/sync/engine/sync_scheduler_impl.cc index b2774e7..01a054a 100644 --- a/sync/engine/sync_scheduler_impl.cc +++ b/sync/engine/sync_scheduler_impl.cc @@ -43,6 +43,7 @@ bool ShouldRequestEarlyExit(const SyncProtocolError& error) { case NOT_MY_BIRTHDAY: case CLEAR_PENDING: case DISABLED_BY_ADMIN: + case USER_ROLLBACK: // If we send terminate sync early then |sync_cycle_ended| notification // would not be sent. If there were no actions then |ACTIONABLE_ERROR| // notification wouldnt be sent either. Then the UI layer would be left diff --git a/sync/test/fake_server/fake_server.cc b/sync/test/fake_server/fake_server.cc index d881080..56780e5 100644 --- a/sync/test/fake_server/fake_server.cc +++ b/sync/test/fake_server/fake_server.cc @@ -148,7 +148,8 @@ scoped_ptr<UpdateSieve> UpdateSieve::Create( FakeServer::FakeServer() : version_(0), store_birthday_(kDefaultStoreBirthday), - authenticated_(true) { + authenticated_(true), + error_type_(sync_pb::SyncEnums::SUCCESS) { keystore_keys_.push_back(kDefaultKeystoreKey); CHECK(CreateDefaultPermanentItems()); } @@ -232,6 +233,8 @@ void FakeServer::HandleCommand(const string& request, if (message.has_store_birthday() && message.store_birthday() != store_birthday_) { error_code = sync_pb::SyncEnums::NOT_MY_BIRTHDAY; + } else if (error_type_ != sync_pb::SyncEnums::SUCCESS) { + error_code = error_type_; } else { bool success = false; switch (message.message_contents()) { @@ -506,6 +509,15 @@ void FakeServer::SetUnauthenticated() { authenticated_ = false; } +// TODO(pvalenzuela): comments from Richard: we should look at +// mock_connection_manager.cc and take it as a warning. This style of injecting +// errors works when there's one or two conditions we care about, but it can +// eventually lead to a hairball once we have many different conditions and +// triggering logic. +void FakeServer::TriggerError(const sync_pb::SyncEnums::ErrorType& error_type) { + error_type_ = error_type; +} + void FakeServer::AddObserver(Observer* observer) { observers_.AddObserver(observer); } diff --git a/sync/test/fake_server/fake_server.h b/sync/test/fake_server/fake_server.h index 71fdc9c..fa1b4d5 100644 --- a/sync/test/fake_server/fake_server.h +++ b/sync/test/fake_server/fake_server.h @@ -70,6 +70,9 @@ class FakeServer { // authentication error. void SetUnauthenticated(); + // Return |error_type| on next sync request. + void TriggerError(const sync_pb::SyncEnums::ErrorType& error_type); + // Adds |observer| to FakeServer's observer list. This should be called // before the Profile associated with |observer| is connected to the server. void AddObserver(Observer* observer); @@ -142,6 +145,8 @@ class FakeServer { // All Keystore keys known to the server. std::vector<std::string> keystore_keys_; + sync_pb::SyncEnums::ErrorType error_type_; + // FakeServer's observers. ObserverList<Observer, true> observers_; }; |