示例#1
0
 /**
  * Rotate.
  *
  * @param b the b
  * @param degrees the degrees
  * @return the bitmap
  */
 private Bitmap rotate(final Bitmap b, int degrees) {
   Logger.v(TAG, "rotate entry");
   Bitmap bitmap = b;
   if (degrees != 0 && bitmap != null) {
     Matrix m = new Matrix();
     m.setRotate(degrees, (float) bitmap.getWidth() / 2, (float) bitmap.getHeight() / 2);
     try {
       Bitmap bitmapRotated =
           Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), m, true);
       if (bitmap != bitmapRotated) {
         bitmap.recycle();
         bitmap = bitmapRotated;
       } else {
         Logger.d(TAG, "no need to rotate");
       }
     } catch (OutOfMemoryError ex) {
       // We have no memory to rotate. Return the original bitmap.
       ex.printStackTrace();
     }
   } else {
     Logger.d(TAG, "rotate no need to rotate");
   }
   Logger.v(TAG, "rotate exit");
   return bitmap;
 }
示例#2
0
 /**
  * Full size bitmap.
  *
  * @param maxNumberOfPixels the max number of pixels
  * @param rotateAsNeeded the rotate as needed
  * @return the bitmap
  */
 public Bitmap fullSizeBitmap(int maxNumberOfPixels, boolean rotateAsNeeded) {
   Logger.v(TAG, "fullSizeBitmap entry");
   int minSideLength = getProperWindowSize();
   String path = mUri.getPath();
   ParcelFileDescriptor pfdInput = null;
   try {
     pfdInput = ParcelFileDescriptor.open(new File(path), ParcelFileDescriptor.MODE_READ_ONLY);
   } catch (FileNotFoundException e) {
     Logger.e(TAG, "got exception decoding bitmap ");
     e.printStackTrace();
   }
   Bitmap bitmap = null;
   bitmap = makeBitmap(minSideLength, maxNumberOfPixels, null, null, pfdInput, null);
   if (bitmap != null && rotateAsNeeded) {
     Bitmap rotatedBitmap = rotate(bitmap, getDegreesRotated());
     if (rotatedBitmap != null && rotatedBitmap != bitmap) {
       Logger.v(TAG, "fullSizeBitmap rotate");
       bitmap.recycle();
       bitmap = rotatedBitmap;
     } else {
       Logger.d(TAG, "fullSizeBitmap no need to roate");
     }
   }
   Logger.v(TAG, "fullSizeBitmap exit");
   return bitmap;
 }
  /** Test the inner class FileTransferAdapter */
  public void testCase7_FileTransferAdapter() throws Throwable {
    Logger.v(TAG, "testCase7_FileTransferAdapter()");
    One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter();
    IRemoteOne2OneChatWindow remoteChatWindow =
        (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow();
    MockRemoteOne2OneChatWindow mockRemoteChatWindow =
        (MockRemoteOne2OneChatWindow) remoteChatWindow;
    FileStruct mockFileStruct = new FileStruct("", "", MOCK_SIZE, new Object(), new Date());
    FileTransferAdapter fileTransferAdapter =
        (FileTransferAdapter) chatWindowAdapter.addReceivedFileTransfer(mockFileStruct);

    // Test FileTransferAdapter#setFilePath()
    mockRemoteChatWindow.mockRemoteFileTransfer.isSetFilePathCalled = false;
    fileTransferAdapter.setFilePath(MOCK_FILEPATH);
    assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetFilePathCalled);

    // Test FileTransferAdapter#setProgress()
    mockRemoteChatWindow.mockRemoteFileTransfer.isSetProgressCalled = false;
    fileTransferAdapter.setProgress(MOCK_PROGRESS);
    assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetProgressCalled);

    // Test FileTransferAdapter#setStatus()
    mockRemoteChatWindow.mockRemoteFileTransfer.isSetStatusCalled = false;
    fileTransferAdapter.setStatus(Status.FINISHED);
    assertTrue(mockRemoteChatWindow.mockRemoteFileTransfer.isSetStatusCalled);
  }
  /** Test the inner class SentChatMessageAdapter */
  public void testCase9_SentChatMessageAdapter() throws Throwable {
    Logger.v(TAG, "testCase9_SentChatMessageAdapter()");
    One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter();
    IRemoteOne2OneChatWindow remoteChatWindow =
        (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow();
    MockRemoteOne2OneChatWindow mockRemoteChatWindow =
        (MockRemoteOne2OneChatWindow) remoteChatWindow;
    SentChatMessageAdapter sentChatMessageAdapter =
        (SentChatMessageAdapter) chatWindowAdapter.addSentMessage(null, 0);

    // Test SentChatMessageAdapter#getId()
    mockRemoteChatWindow.mockRemoteSentChatMessage.isGetIdCalled = false;
    sentChatMessageAdapter.getId();
    assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isGetIdCalled);

    // Test SentChatMessageAdapter#updateDate()
    mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateDateCalled = false;
    sentChatMessageAdapter.updateDate(new Date());
    assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateDateCalled);

    // Test SentChatMessageAdapter#updateStatus()
    mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateStatusCalled = false;
    sentChatMessageAdapter.updateStatus(ChatView.ISentChatMessage.Status.DISPLAYED);
    assertTrue(mockRemoteChatWindow.mockRemoteSentChatMessage.isUpdateStatusCalled);
  }
 /** Test the function removeChatWindow() */
 public void testCase4_RemoveChatWindow() throws Throwable {
   Logger.v(TAG, "testCase4_RemoveChatWindow()");
   assertFalse(mRemoteChatWindowManager.removeChatWindow(null));
   // Add One2OneChatWindow
   IOne2OneChatWindow remoteOne2OneChatWindow =
       (IOne2OneChatWindow)
           mRemoteChatWindowManager.addOne2OneChatWindow(
               MOCK_TAG, new Participant(MOCK_NUMBER, MOCK_NAME));
   // Remove One2OneChatWindow
   mMockRemoteChatWindowManager.isRemoveOne2OneChatWindowCalled = false;
   boolean removeOne2OneChatWindowResult =
       mRemoteChatWindowManager.removeChatWindow(remoteOne2OneChatWindow);
   assertTrue(removeOne2OneChatWindowResult);
   assertTrue(mMockRemoteChatWindowManager.isRemoveOne2OneChatWindowCalled);
   mMockRemoteChatWindowManager.isRemoveOne2OneChatWindowCalled = false;
   // Add GroupChatWindow
   IGroupChatWindow remoteGroupChatWindow =
       (IGroupChatWindow)
           mRemoteChatWindowManager.addGroupChatWindow(MOCK_TAG2, getParticipantList());
   // remove GroupChatWindow
   mMockRemoteChatWindowManager.isRemoveGroupChatWindowCalled = false;
   boolean removeGroupChatWindowResult =
       mRemoteChatWindowManager.removeChatWindow(remoteGroupChatWindow);
   assertTrue(removeGroupChatWindowResult);
   assertTrue(mMockRemoteChatWindowManager.isRemoveGroupChatWindowCalled);
   mMockRemoteChatWindowManager.isRemoveGroupChatWindowCalled = false;
 }
示例#6
0
 /**
  * Gets the degrees rotated.
  *
  * @return the degrees rotated
  */
 private int getDegreesRotated() {
   Logger.v(TAG, "getDegreesRotated entry");
   int degreesRotated = 0;
   int orientation = 0;
   String dataPath = mUri.getPath();
   try {
     ExifInterface exif = new ExifInterface(dataPath);
     orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
     degreesRotated = getExifRotation(orientation);
   } catch (IOException ex) {
     Logger.d(TAG, "getDegreesRotated cannot read exif");
     ex.printStackTrace();
   }
   Logger.v(TAG, "getDegreesRotated exit with degreesRotated: " + degreesRotated);
   return degreesRotated;
 }
 @Override
 public void onCreate() {
   super.onCreate();
   AndroidFactory.setApplicationContext(getApplicationContext());
   Logger.initialize(getApplicationContext());
   Logger.v(TAG, "onCreate() entry");
   if (!ApiManager.initialize(getApplicationContext())) {
     Logger.e(TAG, "onCreate() ApiManager initialization failed!");
   }
   ContactsListManager.initialize(getApplicationContext());
   startService(new Intent(this, ApiService.class));
   // Init UnreadMessageManager
   UnreadMessageManager.getInstance();
   EmoticonsModelImpl.init(getApplicationContext());
   controlRcseComponent();
   Logger.v(TAG, "onCreate() exit");
 }
 /** Test the function switchChatWindowByTag() */
 public void testCase3_SwitchChatWindowByTag() throws Throwable {
   Logger.v(TAG, "testCase3_SwitchChatWindowByTag()");
   mMockRemoteChatWindowManager.isSwitchChatWindowByTagCalled = false;
   ParcelUuid parcelUuid = new ParcelUuid(new UUID(1, 1));
   mRemoteChatWindowManager.switchChatWindowByTag(parcelUuid);
   assertTrue(mMockRemoteChatWindowManager.isSwitchChatWindowByTagCalled);
   mMockRemoteChatWindowManager.isSwitchChatWindowByTagCalled = false;
 }
 public void tearDown() throws Exception {
   Logger.v(TAG, "tearDown()");
   // Remove RemoteChatWindowManager of binder
   mBinder.removeChatWindowManager(mMockRemoteChatWindowManager);
   mBinder = null;
   mMockRemoteChatWindowManager = null;
   mChatWindowManagerAdapters = null;
   mRemoteChatWindowManager = null;
   super.tearDown();
 }
 /** Test the function addGroupChatWindow() */
 public void testCase2_AddGroupChatWindow() throws Throwable {
   Logger.v(TAG, "testCase2_AddOne2OneChatWindow()");
   mMockRemoteChatWindowManager.isAddGroupChatWindowCalled = false;
   IGroupChatWindow remoteGroupChatWindow =
       (IGroupChatWindow)
           mRemoteChatWindowManager.addGroupChatWindow(MOCK_TAG2, getParticipantList());
   assertNotNull(remoteGroupChatWindow);
   assertTrue(mMockRemoteChatWindowManager.isAddGroupChatWindowCalled);
   mMockRemoteChatWindowManager.isAddGroupChatWindowCalled = false;
 }
示例#11
0
 /**
  * Make bitmap.
  *
  * @param minSideLength the min side length
  * @param maxNumOfPixels the max num of pixels
  * @param uri the uri
  * @param cr the cr
  * @param pfd the pfd
  * @param options the options
  * @return the bitmap
  */
 private Bitmap makeBitmap(
     int minSideLength,
     int maxNumOfPixels,
     Uri uri,
     ContentResolver cr,
     ParcelFileDescriptor pfd,
     final BitmapFactory.Options options) {
   Logger.v(TAG, "makeBitmap entry");
   if (pfd == null) {
     Logger.d(TAG, "makeBitmap pfd is null");
     return null;
   }
   try {
     BitmapFactory.Options tempOptions = options;
     if (tempOptions == null) {
       tempOptions = new BitmapFactory.Options();
     }
     FileDescriptor fd = pfd.getFileDescriptor();
     tempOptions.inJustDecodeBounds = true;
     BitmapFactory.decodeFileDescriptor(fd, null, tempOptions);
     if (tempOptions.mCancel || tempOptions.outWidth == -1 || tempOptions.outHeight == -1) {
       return null;
     }
     tempOptions.inSampleSize = computeSampleSize(tempOptions, minSideLength, maxNumOfPixels);
     tempOptions.inJustDecodeBounds = false;
     // for zoom pan performance enhancement,
     // load full size bitmap in format RGB_565, with dither option
     // on
     tempOptions.inDither = false;
     tempOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
     // options.inDither = true;
     // options.inPreferredConfig = Bitmap.Config.RGB_565;
     Logger.v(TAG, "makeBitmap exit");
     return BitmapFactory.decodeFileDescriptor(fd, null, tempOptions);
   } catch (OutOfMemoryError ex) {
     Logger.e(TAG, "got oom exception");
     ex.printStackTrace();
     return null;
   } finally {
     closeSilently(pfd);
   }
 }
 /** Create a ParticipantList */
 private List<ParticipantInfo> getParticipantList() {
   Logger.v(TAG, "getParticipantList()");
   ParticipantInfo participantInfo1 =
       new ParticipantInfo(new Participant(MOCK_NUMBER, MOCK_NAME), User.STATE_CONNECTED);
   ParticipantInfo participantInfo2 =
       new ParticipantInfo(new Participant(MOCK_NUMBER2, MOCK_NAME2), User.STATE_CONNECTED);
   List<ParticipantInfo> participantList = new ArrayList<ParticipantInfo>();
   participantList.add(participantInfo1);
   participantList.add(participantInfo2);
   return participantList;
 }
示例#13
0
 /**
  * Close silently.
  *
  * @param c the c
  */
 private void closeSilently(ParcelFileDescriptor c) {
   Logger.v(TAG, "closeSilently entry");
   if (c == null) {
     return;
   }
   try {
     c.close();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
 /** Test the function addOne2OneChatWindow() */
 public void testCase1_AddOne2OneChatWindow() throws Throwable {
   Logger.v(TAG, "testCase1_AddOne2OneChatWindow()");
   mMockRemoteChatWindowManager.isAddOne2OneChatWindowCalled = false;
   IOne2OneChatWindow remoteOne2OneChatWindow =
       (IOne2OneChatWindow)
           mRemoteChatWindowManager.addOne2OneChatWindow(
               MOCK_TAG, new Participant(MOCK_NUMBER, MOCK_NAME));
   assertNotNull(remoteOne2OneChatWindow);
   assertTrue(mMockRemoteChatWindowManager.isAddOne2OneChatWindowCalled);
   mMockRemoteChatWindowManager.isAddOne2OneChatWindowCalled = false;
 }
  /** Test the inner class ReceivedChatMessageAdapter */
  public void testCase8_ReceivedChatMessageAdapter() throws Throwable {
    Logger.v(TAG, "testCase8_ReceivedChatMessageAdapter()");
    One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter();
    IRemoteOne2OneChatWindow remoteChatWindow =
        (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow();
    MockRemoteOne2OneChatWindow mockRemoteChatWindow =
        (MockRemoteOne2OneChatWindow) remoteChatWindow;
    ReceivedChatMessageAdapter receivedChatMessageAdapter =
        (ReceivedChatMessageAdapter) chatWindowAdapter.addReceivedMessage(null, false);

    // Test FileTransferAdapter#getId()
    mockRemoteChatWindow.mockRemoteReceivedChatMessage.isGetIdCalled = false;
    receivedChatMessageAdapter.getId();
    assertTrue(mockRemoteChatWindow.mockRemoteReceivedChatMessage.isGetIdCalled);
  }
 /** Use reflect to get GroupChatWindowAdapter instance */
 private GroupChatWindowAdapter getGroupChatWindowAdapter() throws Throwable {
   Logger.v(TAG, "getGroupChatWindowAdapter()");
   // Add GroupChatWindow
   mRemoteChatWindowManager.addGroupChatWindow(MOCK_TAG2, getParticipantList());
   // Get WindowBinder#chatWindowManagerAdapters[0]
   ChatWindowManagerAdapter chatWindowManagerAdapter = mChatWindowManagerAdapters.get(0);
   // Get ChatWindowManagerAdapter#mRemoteChatWindows
   Field fieldRemoteChatWindows =
       Utils.getPrivateField(ChatWindowManagerAdapter.class, "mRemoteChatWindows");
   List<BaseChatWindow> mRemoteChatWindows =
       (List<BaseChatWindow>) fieldRemoteChatWindows.get(chatWindowManagerAdapter);
   // Get GroupChatWindowAdapter
   GroupChatWindowAdapter groupChatWindowAdapter =
       (GroupChatWindowAdapter) mRemoteChatWindows.get(0);
   assertNotNull(groupChatWindowAdapter);
   return groupChatWindowAdapter;
 }
 /** Use reflect to get One2OneChatWindowAdapter instance */
 private One2OneChatWindowAdapter getOne2OneChatWindowAdapter() throws Throwable {
   Logger.v(TAG, "getGroupChatWindowAdapter()");
   // Add One2OneChatWindow
   mRemoteChatWindowManager.addOne2OneChatWindow(
       MOCK_TAG, new Participant(MOCK_NUMBER, MOCK_NAME));
   // Get WindowBinder#chatWindowManagerAdapters[0]
   ChatWindowManagerAdapter chatWindowManagerAdapter = mChatWindowManagerAdapters.get(0);
   // Get ChatWindowManagerAdapter#mRemoteChatWindows
   Field fieldRemoteChatWindows =
       Utils.getPrivateField(ChatWindowManagerAdapter.class, "mRemoteChatWindows");
   List<BaseChatWindow> mRemoteChatWindows =
       (List<BaseChatWindow>) fieldRemoteChatWindows.get(chatWindowManagerAdapter);
   // Get GroupChatWindowAdapter
   One2OneChatWindowAdapter one2OneChatWindowAdapter =
       (One2OneChatWindowAdapter) mRemoteChatWindows.get(0);
   assertNotNull(one2OneChatWindowAdapter);
   return one2OneChatWindowAdapter;
 }
 @Override
 public void enterChatMode(String number) {
   Logger.d(TAG, "enterChatMode() entry, number " + number);
   if (PluginUtils.getMessagingMode() == 0) {
     if (number.startsWith(IpMessageConsts.JOYN_START)) {
       number = number.substring(4);
     }
   }
   Message controllerMessage =
       PluginController.obtainMessage(
           ChatController.EVENT_SHOW_WINDOW, PhoneUtils.formatNumberToInternational(number));
   controllerMessage.sendToTarget();
   if ((PluginUtils.getMessagingMode() == 1) && (PluginUtils.translateThreadId(number) == 1)) {
     Logger.v(TAG, "enterChatMode(), open Window = " + number);
     Intent intent = new Intent(InvitationDialog.ACTION);
     intent.putExtra(RcsNotification.CONTACT, number);
     intent.putExtra(InvitationDialog.KEY_STRATEGY, InvitationDialog.STRATEGY_IPMES_SEND_BY_SMS);
     intent.putExtra("showDialog", true);
     intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
     AndroidFactory.getApplicationContext().startActivity(intent);
   }
   super.enterChatMode(number);
 }
 @Override
 public void setUp() throws Exception {
   Logger.v(TAG, "setUp()");
   super.setUp();
   // Get WindowBinder from ApiService
   Intent intent = new Intent(getSystemContext(), ApiService.class);
   intent.setAction(IRemoteWindowBinder.class.getName());
   IBinder service = bindService(intent);
   assertTrue(service.isBinderAlive());
   mBinder = (WindowBinder) IRemoteWindowBinder.Stub.asInterface(service);
   assertNotNull(mBinder);
   mMockRemoteChatWindowManager = new MockRemoteChatWindowManager();
   Field fieldRemoteChatWindowManagers =
       Utils.getPrivateField(WindowBinder.class, "mChatWindowManagerAdapters");
   mChatWindowManagerAdapters =
       (List<ChatWindowManagerAdapter>) fieldRemoteChatWindowManagers.get(mBinder);
   // Add RemoteChatWindowManager to binder
   int startSize = mChatWindowManagerAdapters.size();
   mBinder.addChatWindowManager(mMockRemoteChatWindowManager, false);
   assertEquals(startSize + 1, mChatWindowManagerAdapters.size());
   mRemoteChatWindowManager = mChatWindowManagerAdapters.get(0);
   assertNotNull(mRemoteChatWindowManager);
 }
  /** Test the inner class GroupChatWindowAdapter */
  public void testCase6_GroupChatWindowAdapter() throws Throwable {
    Logger.v(TAG, "testCase6_GroupChatWindowAdapter()");
    GroupChatWindowAdapter chatWindowAdapter = getGroupChatWindowAdapter();
    IRemoteGroupChatWindow remoteChatWindow =
        (IRemoteGroupChatWindow) chatWindowAdapter.getChatWindow();
    MockRemoteGroupChatWindow mockRemoteChatWindow = (MockRemoteGroupChatWindow) remoteChatWindow;

    // Test GroupChatWindowAdapter#addChatEventInformation()
    ChatEventStruct chatEventStruct =
        new ChatEventStruct(Information.JOIN, new Object(), new Date());
    mockRemoteChatWindow.isAddChatEventInformationCalled = false;
    chatWindowAdapter.addChatEventInformation(chatEventStruct);
    assertTrue(mockRemoteChatWindow.isAddChatEventInformationCalled);
    mockRemoteChatWindow.isAddChatEventInformationCalled = false;

    // Test GroupChatWindowAdapter#setIsComposing()
    mockRemoteChatWindow.isSetIsComposingCalled = false;
    chatWindowAdapter.setIsComposing(false, new Participant(MOCK_NUMBER, MOCK_NAME));
    assertTrue(mockRemoteChatWindow.isSetIsComposingCalled);
    mockRemoteChatWindow.isSetIsComposingCalled = false;

    // Test GroupChatWindowAdapter#setIsRejoining()
    mockRemoteChatWindow.isSetIsRejoiningCalled = false;
    chatWindowAdapter.setIsRejoining(false);
    assertTrue(mockRemoteChatWindow.isSetIsRejoiningCalled);
    mockRemoteChatWindow.isSetIsRejoiningCalled = false;

    // Test GroupChatWindowAdapter#updateParticipants()
    mockRemoteChatWindow.isUpdateParticipantsCalled = false;
    chatWindowAdapter.updateParticipants(getParticipantList());
    assertTrue(mockRemoteChatWindow.isUpdateParticipantsCalled);
    mockRemoteChatWindow.isUpdateParticipantsCalled = false;

    // Test GroupChatWindowAdapter#addLoadHistoryHeader()
    mockRemoteChatWindow.isAddLoadHistoryHeaderCalled = false;
    chatWindowAdapter.addLoadHistoryHeader(false);
    assertTrue(mockRemoteChatWindow.isAddLoadHistoryHeaderCalled);
    mockRemoteChatWindow.isAddLoadHistoryHeaderCalled = false;

    // Test GroupChatWindowAdapter#addReceivedMessage()
    mockRemoteChatWindow.isAddReceivedMessageCalled = false;
    chatWindowAdapter.addReceivedMessage(null, false);
    assertTrue(mockRemoteChatWindow.isAddReceivedMessageCalled);
    mockRemoteChatWindow.isAddReceivedMessageCalled = false;

    // Test GroupChatWindowAdapter#addSentMessage()
    mockRemoteChatWindow.isAddSentMessageCalled = false;
    chatWindowAdapter.addSentMessage(null, 0);
    assertTrue(mockRemoteChatWindow.isAddSentMessageCalled);
    mockRemoteChatWindow.isAddSentMessageCalled = false;

    // Test GroupChatWindowAdapter#removeAllMessages()
    mockRemoteChatWindow.isRemoveAllMessagesCalled = false;
    chatWindowAdapter.removeAllMessages();
    assertTrue(mockRemoteChatWindow.isRemoveAllMessagesCalled);
    mockRemoteChatWindow.isRemoveAllMessagesCalled = false;

    // Test GroupChatWindowAdapter#updateAllMsgAsRead()
    mockRemoteChatWindow.isUpdateParticipantsCalled = false;
    chatWindowAdapter.updateAllMsgAsRead();
    assertTrue(mockRemoteChatWindow.isUpdateParticipantsCalled);
    mockRemoteChatWindow.isUpdateParticipantsCalled = false;
  }
  /** Test the inner class One2OneChatWindowAdapter */
  public void testCase5_One2OneChatWindowAdapter() throws Throwable {
    Logger.v(TAG, "testCase5_One2OneChatWindowAdapter()");
    One2OneChatWindowAdapter chatWindowAdapter = getOne2OneChatWindowAdapter();
    IRemoteOne2OneChatWindow remoteChatWindow =
        (IRemoteOne2OneChatWindow) chatWindowAdapter.getChatWindow();
    MockRemoteOne2OneChatWindow mockRemoteChatWindow =
        (MockRemoteOne2OneChatWindow) remoteChatWindow;
    FileStruct mockFileStruct = new FileStruct("", "", MOCK_SIZE, new Object(), new Date());

    // Test One2OneChatWindowAdapter#addLoadHistoryHeader()
    mockRemoteChatWindow.isAddLoadHistoryHeaderCalled = false;
    chatWindowAdapter.addLoadHistoryHeader(false);
    assertTrue(mockRemoteChatWindow.isAddLoadHistoryHeaderCalled);
    mockRemoteChatWindow.isAddLoadHistoryHeaderCalled = false;

    // Test One2OneChatWindowAdapter#addReceivedFileTransfer()
    mockRemoteChatWindow.isAddReceivedFileTransferCalled = false;
    chatWindowAdapter.addReceivedFileTransfer(mockFileStruct);
    assertTrue(mockRemoteChatWindow.isAddReceivedFileTransferCalled);
    mockRemoteChatWindow.isAddReceivedFileTransferCalled = false;

    // Test One2OneChatWindowAdapter#addReceivedMessage()
    mockRemoteChatWindow.isAddReceivedMessageCalled = false;
    chatWindowAdapter.addReceivedMessage(null, false);
    assertTrue(mockRemoteChatWindow.isAddReceivedMessageCalled);
    mockRemoteChatWindow.isAddReceivedMessageCalled = false;

    // Test One2OneChatWindowAdapter#addSentFileTransfer()
    mockRemoteChatWindow.isAddSentFileTransferCalled = false;
    chatWindowAdapter.addSentFileTransfer(mockFileStruct);
    assertTrue(mockRemoteChatWindow.isAddSentFileTransferCalled);
    mockRemoteChatWindow.isAddSentFileTransferCalled = false;

    // Test One2OneChatWindowAdapter#addSentMessage()
    mockRemoteChatWindow.isAddSentMessageCalled = false;
    chatWindowAdapter.addSentMessage(null, 0);
    assertTrue(mockRemoteChatWindow.isAddSentMessageCalled);
    mockRemoteChatWindow.isAddSentMessageCalled = false;

    // Test One2OneChatWindowAdapter#removeAllMessages()
    mockRemoteChatWindow.isRemoveAllMessagesCalled = false;
    chatWindowAdapter.removeAllMessages();
    assertTrue(mockRemoteChatWindow.isRemoveAllMessagesCalled);
    mockRemoteChatWindow.isRemoveAllMessagesCalled = false;

    // Test One2OneChatWindowAdapter#setFileTransferEnable()
    mockRemoteChatWindow.isSetFileTransferEnableCalled = false;
    chatWindowAdapter.setFileTransferEnable(0);
    assertTrue(mockRemoteChatWindow.isSetFileTransferEnableCalled);
    mockRemoteChatWindow.isSetFileTransferEnableCalled = false;

    // Test One2OneChatWindowAdapter#setIsComposing()
    mockRemoteChatWindow.isSetIsComposingCalled = false;
    chatWindowAdapter.setIsComposing(false);
    assertTrue(mockRemoteChatWindow.isSetIsComposingCalled);
    mockRemoteChatWindow.isSetIsComposingCalled = false;

    // Test One2OneChatWindowAdapter#setRemoteOfflineReminder()
    mockRemoteChatWindow.isSetRemoteOfflineReminderCalled = false;
    chatWindowAdapter.setRemoteOfflineReminder(false);
    assertTrue(mockRemoteChatWindow.isSetRemoteOfflineReminderCalled);
    mockRemoteChatWindow.isSetRemoteOfflineReminderCalled = false;

    // Test One2OneChatWindowAdapter#updateAllMsgAsRead()
    mockRemoteChatWindow.isUpdateAllMsgAsReadCalled = false;
    chatWindowAdapter.updateAllMsgAsRead();
    assertTrue(mockRemoteChatWindow.isUpdateAllMsgAsReadCalled);
    mockRemoteChatWindow.isUpdateAllMsgAsReadCalled = false;
  }