Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / sync / about_sync_util_unittest.cc
blob6755d1b9f0f3dc4ee305f3b643ec90a500ebe1fd
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/sync/about_sync_util.h"
8 #include "chrome/browser/sync/profile_sync_service_mock.h"
9 #include "content/public/test/test_browser_thread.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 using ::testing::NiceMock;
14 using ::testing::Return;
15 using ::testing::_;
16 using content::BrowserThread;
18 namespace sync_ui_util {
19 namespace {
21 TEST(SyncUIUtilTestAbout, ConstructAboutInformationWithUnrecoverableErrorTest) {
22 base::MessageLoopForUI message_loop;
23 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
24 scoped_ptr<Profile> profile(
25 ProfileSyncServiceMock::MakeSignedInTestingProfile());
26 NiceMock<ProfileSyncServiceMock> service(profile.get());
28 // Will be released when the dictionary is destroyed
29 base::string16 str(base::ASCIIToUTF16("none"));
31 browser_sync::SyncBackendHost::Status status;
33 EXPECT_CALL(service, HasSyncSetupCompleted())
34 .WillOnce(Return(true));
35 EXPECT_CALL(service, QueryDetailedSyncStatus(_))
36 .WillOnce(Return(false));
38 EXPECT_CALL(service, HasUnrecoverableError())
39 .WillRepeatedly(Return(true));
41 EXPECT_CALL(service, GetLastSyncedTimeString())
42 .WillOnce(Return(str));
44 scoped_ptr<base::DictionaryValue> strings(
45 ConstructAboutInformation(&service));
47 EXPECT_TRUE(strings->HasKey("unrecoverable_error_detected"));
50 } // namespace
51 } // namespace sync_ui_util