Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1285)

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui.swtbot_test/src/com/google/dart/tools/ui/internal/refactoring/AbstractDartEditorTest.java

Issue 18548007: UI tests for 'Rename' and 'Extract Local Variable' refactorings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.tools.ui.swtbot_test/src/com/google/dart/tools/ui/internal/refactoring/AbstractDartEditorTest.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui.swtbot_test/src/com/google/dart/tools/ui/internal/refactoring/AbstractDartEditorTest.java b/editor/tools/plugins/com.google.dart.tools.ui.swtbot_test/src/com/google/dart/tools/ui/internal/refactoring/AbstractDartEditorTest.java
deleted file mode 100644
index 03b47aef21dbc521fa5609214f2fd379908fc14b..0000000000000000000000000000000000000000
--- a/editor/tools/plugins/com.google.dart.tools.ui.swtbot_test/src/com/google/dart/tools/ui/internal/refactoring/AbstractDartEditorTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2012, the Dart project authors.
- *
- * Licensed under the Eclipse Public License v1.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.eclipse.org/legal/epl-v10.html
- *
- * 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.google.dart.tools.ui.internal.refactoring;
-
-import static org.fest.assertions.Assertions.assertThat;
-
-import com.google.dart.tools.core.model.CompilationUnit;
-import com.google.dart.tools.ui.internal.text.editor.DartEditor;
-import com.google.dart.tools.ui.refactoring.AbstractDartTest;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.texteditor.AbstractTextEditor;
-
-import java.lang.reflect.Method;
-
-/**
- * Base for {@link DartEditor} tests.
- */
-public class AbstractDartEditorTest extends AbstractDartTest {
- /**
- * Opens given {@link CompilationUnit} in the {@link DartEditor}.
- */
- public static DartEditor openEditor(CompilationUnit unit) throws Exception {
- return (DartEditor) IDE.openEditor(
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(),
- (IFile) unit.getResource());
- }
-
- protected DartEditor testEditor;
- protected ISourceViewer sourceViewer;
-
- protected StyledText textWidget;
-
- /**
- * Opens {@link DartEditor} for unit <code>Test.dart</code> with given content.
- */
- public void openTestEditor(String... lines) throws Exception {
- setTestUnitContent(lines);
- testEditor = openEditor(testUnit);
- // prepare ISourceViewer and StyledText
- {
- Method method = AbstractTextEditor.class.getDeclaredMethod("getSourceViewer");
- method.setAccessible(true);
- sourceViewer = (ISourceViewer) method.invoke(testEditor);
- }
- textWidget = sourceViewer.getTextWidget();
- }
-
- /**
- * @return the {@link IAction} with given definition ID, not <code>null</code>.
- */
- protected final IAction getEditorAction(String id) {
- IActionBars actionBars = testEditor.getEditorSite().getActionBars();
- IAction action = actionBars.getGlobalActionHandler(id);
- assertNotNull("Can not find action " + id, action);
- return action;
- }
-
- /**
- * Attempts to find given pattern in the editor source and then places caret into this position.
- * Fails in position was not found.
- */
- protected final void selectAndReveal(String pattern) throws Exception {
- int position = sourceViewer.getDocument().get().indexOf(pattern);
- assertThat(position).isNotEqualTo(-1);
- testEditor.selectAndReveal(position, 0);
- }
-
- @Override
- protected void tearDown() throws Exception {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
- super.tearDown();
- }
-}
« no previous file with comments | « no previous file | editor/tools/plugins/com.google.dart.tools.ui.swtbot_test/src/com/google/dart/tools/ui/internal/refactoring/EventSender.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698