Search in sources :

Example 1 with ConfigureAndroidProjectStepFixture

use of com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.ConfigureAndroidProjectStepFixture in project android by JetBrains.

the class LaunchAndroidApplicationTest method testCppDebugOnEmulatorWithBreakpoint.

/**
   * To verify that sample ndk projects can be imported and breakpoints in code are hit.
   * <p>
   * This is run to qualify releases. Please involve the test team in substantial changes.
   * <p>
   * TR ID: C14578820
   * <p>
   *   <pre>
   *   Test Steps:
   *   1. Open Android Studio
   *   2. Import Teapot from the cloned repo
   *   3. Open TeapotNativeActivity.cpp
   *   4. Click on any method and make sure it finds the method or its declaration
   *   5. Search for the symbol HandleInput and put a break point in the method
   *   6. Deploy to a device/emulator
   *   7. Wait for notification that the debugger is connected
   *   8. Teapot should show up on the device
   *   9. Touch to interact
   *   Verify:
   *   1. After step 9, the breakpoint is triggered.
   *   </pre>
   * <p>
   */
@Ignore("http://b/30795134")
@RunIn(TestGroup.QA)
@Test
public void testCppDebugOnEmulatorWithBreakpoint() throws Exception {
    WelcomeFrameFixture welcomeFrame = WelcomeFrameFixture.find(guiTest.robot());
    welcomeFrame.importCodeSample();
    BrowseSamplesWizardFixture samplesWizard = BrowseSamplesWizardFixture.find(guiTest.robot());
    samplesWizard.selectSample("Ndk/Teapot").clickNext();
    ConfigureAndroidProjectStepFixture configStep = samplesWizard.getConfigureFormFactorStep();
    configStep.enterApplicationName("TeapotTest");
    guiTest.setProjectPath(configStep.getLocationInFileSystem());
    samplesWizard.clickFinish();
    IdeFrameFixture ideFrameFixture = guiTest.ideFrame();
    ideFrameFixture.waitForGradleProjectSyncToFinish().getEditor().open("app/src/main/jni/TeapotNativeActivity.cpp").moveBetween("g_engine.Draw", "Frame()").invokeAction(// First break point - First Frame is drawn
    EditorFixture.EditorAction.TOGGLE_LINE_BREAKPOINT).moveBetween("static int32_t Handle", "Input(").invokeAction(EditorFixture.EditorAction.GOTO_IMPLEMENTATION).invokeAction(// Second break point - HandleInput()
    EditorFixture.EditorAction.TOGGLE_LINE_BREAKPOINT);
    assertThat(guiTest.ideFrame().getEditor().getCurrentLine()).contains("int32_t Engine::HandleInput(");
    createAVD();
    ideFrameFixture.debugApp(APP_NAME).selectDevice(AVD_NAME).clickOk();
    // Wait for the UI App to be up and running, by waiting for the first Frame draw to get hit.
    expectBreakPoint("g_engine.DrawFrame()");
    // Simulate a screen touch
    getEmulatorConnection().tapRunningAvd(400, 400);
    // Wait for the Cpp HandleInput() break point to get hit.
    expectBreakPoint("Engine* eng = (Engine*)app->userData;");
}
Also used : ConfigureAndroidProjectStepFixture(com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.ConfigureAndroidProjectStepFixture) BrowseSamplesWizardFixture(com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.BrowseSamplesWizardFixture) IdeFrameFixture(com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture) WelcomeFrameFixture(com.android.tools.idea.tests.gui.framework.fixture.WelcomeFrameFixture) Ignore(org.junit.Ignore) Test(org.junit.Test) RunIn(com.android.tools.idea.tests.gui.framework.RunIn)

Aggregations

RunIn (com.android.tools.idea.tests.gui.framework.RunIn)1 IdeFrameFixture (com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture)1 WelcomeFrameFixture (com.android.tools.idea.tests.gui.framework.fixture.WelcomeFrameFixture)1 BrowseSamplesWizardFixture (com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.BrowseSamplesWizardFixture)1 ConfigureAndroidProjectStepFixture (com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.ConfigureAndroidProjectStepFixture)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1