Home | History | Annotate | Download | only in sync
      1 // Copyright (c) 2010 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.
      4 
      5 #include "base/basictypes.h"
      6 #include "chrome/browser/sync/sync_ui_util.h"
      7 #include "chrome/browser/sync/profile_sync_service_mock.h"
      8 #include "content/browser/browser_thread.h"
      9 #include "testing/gmock/include/gmock/gmock.h"
     10 #include "testing/gmock/include/gmock/gmock-actions.h"
     11 #include "testing/gtest/include/gtest/gtest.h"
     12 
     13 using ::testing::Return;
     14 using ::testing::NiceMock;
     15 TEST(SyncUIUtilTest, ConstructAboutInformationWithUnrecoverableErrorTest) {
     16   MessageLoopForUI message_loop;
     17   BrowserThread ui_thread(BrowserThread::UI, &message_loop);
     18   NiceMock<ProfileSyncServiceMock> service;
     19   DictionaryValue strings;
     20 
     21   // Will be released when the dictionary is destroyed
     22   string16 str(ASCIIToUTF16("none"));
     23 
     24   browser_sync::SyncBackendHost::Status status =
     25       { browser_sync::SyncBackendHost::Status::OFFLINE_UNUSABLE };
     26 
     27   EXPECT_CALL(service, HasSyncSetupCompleted())
     28               .WillOnce(Return(true));
     29   EXPECT_CALL(service, QueryDetailedSyncStatus())
     30               .WillOnce(Return(status));
     31 
     32   EXPECT_CALL(service, unrecoverable_error_detected())
     33              .WillOnce(Return(true));
     34 
     35   EXPECT_CALL(service, GetLastSyncedTimeString())
     36              .WillOnce(Return(str));
     37 
     38   sync_ui_util::ConstructAboutInformation(&service, &strings);
     39 
     40   EXPECT_TRUE(strings.HasKey("unrecoverable_error_detected"));
     41 }
     42 
     43