| /* |
| * Copyright (C) 2015 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| package com.android.documentsui; |
| |
| import android.net.Uri; |
| import android.os.RemoteException; |
| import android.test.suitebuilder.annotation.LargeTest; |
| |
| @LargeTest |
| public class FilesActivityUiTest extends ActivityTest<FilesActivity> { |
| |
| public FilesActivityUiTest() { |
| super(FilesActivity.class); |
| } |
| |
| @Override |
| public void setUp() throws Exception { |
| super.setUp(); |
| initTestFiles(); |
| } |
| |
| @Override |
| public void initTestFiles() throws RemoteException { |
| Uri uri = mDocsHelper.createFolder(rootDir0, dirName1); |
| mDocsHelper.createFolder(uri, childDir1); |
| |
| mDocsHelper.createDocument(rootDir0, "text/plain", "file0.log"); |
| mDocsHelper.createDocument(rootDir0, "image/png", "file1.png"); |
| mDocsHelper.createDocument(rootDir0, "text/csv", "file2.csv"); |
| |
| mDocsHelper.createDocument(rootDir1, "text/plain", "anotherFile0.log"); |
| mDocsHelper.createDocument(rootDir1, "text/plain", "poodles.text"); |
| } |
| |
| public void testFilesListed() throws Exception { |
| bots.directory.assertDocumentsPresent("file0.log", "file1.png", "file2.csv"); |
| } |
| |
| public void testRootClick_SetsWindowTitle() throws Exception { |
| bots.roots.openRoot("Images"); |
| bots.main.assertWindowTitle("Images"); |
| } |
| |
| public void testFilesList_LiveUpdate() throws Exception { |
| mDocsHelper.createDocument(rootDir0, "yummers/sandwich", "Ham & Cheese.sandwich"); |
| |
| bots.directory.waitForDocument("Ham & Cheese.sandwich"); |
| bots.directory.assertDocumentsPresent( |
| "file0.log", "file1.png", "file2.csv", "Ham & Cheese.sandwich"); |
| } |
| |
| public void testNavigateByBreadcrumb() throws Exception { |
| bots.directory.openDocument(dirName1); |
| bots.directory.waitForDocument(childDir1); // wait for known content |
| bots.directory.assertDocumentsPresent(childDir1); |
| |
| bots.breadcrumb.revealAsNeeded(); |
| device.waitForIdle(); |
| bots.breadcrumb.assertItemsPresent(dirName1, "TEST_ROOT_0"); |
| |
| bots.breadcrumb.clickItem("TEST_ROOT_0"); |
| bots.directory.waitForDocument(dirName1); |
| } |
| } |