summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-06-28 22:49:27 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-06-28 22:49:27 +0000
commitbfda268a6036d30caae75a86951bbb8a445287c5 (patch)
treee8b2577a922ac8467562179fde7948874b6aebcc
parent6d69b0fc5ddf8d9b9fc6982d4d133b254ade5913 (diff)
parent6c77b8cfdfcedd11b9c98c917afb8a3e28974e9e (diff)
downloadtools-studio-master-dev.tar.gz
Snap for 6635814 from 6c77b8cfdfcedd11b9c98c917afb8a3e28974e9e to studio-4.1-releasestudio-4.1.1studio-4.1.0studio-master-dev
Change-Id: Idb96316e7f4ea694d2a5ff144a68edc4546b8599
-rw-r--r--android-studio-plugin/src/com/google/gct/studio/samples/GithubRepoContents.java2
-rw-r--r--core-plugin/BUILD6
-rw-r--r--google-login-plugin/BUILD21
-rw-r--r--google-login-plugin/google-login-as.iml2
-rw-r--r--google-login-plugin/src/com/google/gct/login/ui/GoogleLoginAction.java29
-rw-r--r--google-login-plugin/testSrc/com/google/gct/login/ui/GoogleLoginActionTest.kt57
6 files changed, 10 insertions, 107 deletions
diff --git a/android-studio-plugin/src/com/google/gct/studio/samples/GithubRepoContents.java b/android-studio-plugin/src/com/google/gct/studio/samples/GithubRepoContents.java
index adacdd7..d4e36fa 100644
--- a/android-studio-plugin/src/com/google/gct/studio/samples/GithubRepoContents.java
+++ b/android-studio-plugin/src/com/google/gct/studio/samples/GithubRepoContents.java
@@ -63,7 +63,7 @@ public final class GithubRepoContents {
cacheDirectory = new File(FileUtil.getTempDirectory(), "github_cache");
}
if (branch == null || branch.trim().isEmpty()) {
- branch = "master";
+ branch = "HEAD";
}
URL parsedUrl;
diff --git a/core-plugin/BUILD b/core-plugin/BUILD
index bf4b155..b368e9a 100644
--- a/core-plugin/BUILD
+++ b/core-plugin/BUILD
@@ -12,16 +12,18 @@ iml_module(
iml_files = ["google-cloud-tools-core-as.iml"],
# do not sort: must match IML order
test_runtime_deps = [
+ "//tools/idea/java/structuralsearch-java:intellij.java.structuralSearch",
"//tools/idea/uast/uast-tests:intellij.platform.uast.tests",
"//tools/idea/jvm/jvm-analysis-java-tests:intellij.jvm.analysis.java.tests",
"//tools/idea:intellij.java.ui.tests",
+ "//tools/idea/plugins/testng:intellij.testng",
"//tools/idea/java/manifest:intellij.java.manifest",
"//tools/idea/plugins/java-i18n:intellij.java.i18n",
"//tools/idea/plugins/java-decompiler/plugin:intellij.java.decompiler",
+ "//tools/idea/plugins/coverage:intellij.java.coverage",
"//tools/idea/plugins/ui-designer:intellij.java.guiForms.designer",
+ "//tools/idea/plugins/eclipse:intellij.eclipse",
"//tools/idea/java/plugin:intellij.java.plugin",
- "//tools/idea/plugins/maven/error-prone-compiler:intellij.maven.errorProne.compiler",
- "//tools/adt/idea/adt-branding:intellij.android.adt.branding",
],
test_srcs = ["testSrc"],
test_tags = ["manual"],
diff --git a/google-login-plugin/BUILD b/google-login-plugin/BUILD
index bf77da7..68964db 100644
--- a/google-login-plugin/BUILD
+++ b/google-login-plugin/BUILD
@@ -12,22 +12,9 @@ iml_module(
iml_files = ["google-login-as.iml"],
# do not sort: must match IML order
test_runtime_deps = [
- "//tools/idea/jvm/jvm-analysis-impl:intellij.jvm.analysis.impl",
- "//tools/idea/uast/uast-tests:intellij.platform.uast.tests",
- "//tools/idea/plugins/IntelliLang/intellilang-jps-plugin:intellij.java.langInjection.jps",
- "//tools/idea/jvm/jvm-analysis-java-tests:intellij.jvm.analysis.java.tests",
- "//tools/idea:intellij.java.ui.tests",
- "//tools/idea/java/manifest:intellij.java.manifest",
- "//tools/idea/plugins/java-i18n:intellij.java.i18n",
- "//tools/idea/plugins/java-decompiler/plugin:intellij.java.decompiler",
- "//tools/idea/plugins/ui-designer:intellij.java.guiForms.designer",
- "//tools/idea/java/plugin:intellij.java.plugin",
- "//tools/idea/java/ide-resources:intellij.java.ide.resources",
- "//tools/idea/java/compiler/instrumentation-util-8:intellij.java.compiler.instrumentationUtil.java8",
- "//prebuilts/tools/common/m2/repository/com/jetbrains/intellij/documentation/tips-intellij-idea-community/201.11:jar",
- "//tools/idea/.idea/libraries:precompiled_jshell-frontend",
- "//tools/idea/plugins/maven/error-prone-compiler:intellij.maven.errorProne.compiler",
- "//tools/adt/idea/adt-branding:intellij.android.adt.branding",
+ "//tools/idea/xml/dom-impl:intellij.xml.dom.impl",
+ "//tools/idea/platform/testFramework/extensions:intellij.platform.testExtensions",
+ "//tools/idea/images:intellij.platform.images",
],
test_srcs = ["testSrc"],
test_tags = ["manual"],
@@ -84,7 +71,5 @@ iml_module(
"//tools/idea/.idea/libraries:http-client",
"//prebuilts/tools/common/m2/repository/junit/junit/4.12:jar[test]",
"//tools/idea/.idea/libraries:gson",
- "//tools/adt/idea/android-test-framework:intellij.android.testFramework[module, test]",
- "//tools/idea/platform/testFramework:intellij.platform.testFramework[module, test]",
],
)
diff --git a/google-login-plugin/google-login-as.iml b/google-login-plugin/google-login-as.iml
index 9ca1acd..df273e3 100644
--- a/google-login-plugin/google-login-as.iml
+++ b/google-login-plugin/google-login-as.iml
@@ -94,7 +94,5 @@
</library>
</orderEntry>
<orderEntry type="library" name="gson" level="project" />
- <orderEntry type="module" module-name="intellij.android.testFramework" scope="TEST" />
- <orderEntry type="module" module-name="intellij.platform.testFramework" scope="TEST" />
</component>
</module> \ No newline at end of file
diff --git a/google-login-plugin/src/com/google/gct/login/ui/GoogleLoginAction.java b/google-login-plugin/src/com/google/gct/login/ui/GoogleLoginAction.java
index 02d6240..bfac464 100644
--- a/google-login-plugin/src/com/google/gct/login/ui/GoogleLoginAction.java
+++ b/google-login-plugin/src/com/google/gct/login/ui/GoogleLoginAction.java
@@ -15,7 +15,6 @@
*/
package com.google.gct.login.ui;
-import com.google.common.annotations.VisibleForTesting;
import com.google.gct.login.CredentialedUser;
import com.google.gct.login.GoogleLogin;
import com.intellij.openapi.actionSystem.AnAction;
@@ -25,8 +24,6 @@ import com.intellij.openapi.actionSystem.RightAlignedToolbarAction;
import com.intellij.openapi.ui.popup.ComponentPopupBuilder;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
-import com.intellij.openapi.util.SystemInfo;
-import com.intellij.util.Function;
import icons.GoogleLoginIcons;
import javax.swing.*;
@@ -37,19 +34,6 @@ import java.awt.*;
*/
public class GoogleLoginAction extends AnAction implements RightAlignedToolbarAction {
- @VisibleForTesting
- Function<Void, Boolean> incompatibilityOverride = null;
-
- @VisibleForTesting
- boolean isIncompatibleOS() {
- if (incompatibilityOverride == null) {
- return SystemInfo.isChromeOS;
- }
- else {
- return incompatibilityOverride.fun(null);
- }
- }
-
private static final String SIGN_IN_MESSAGE = "Sign in to Google...";
@Override
@@ -60,24 +44,16 @@ public class GoogleLoginAction extends AnAction implements RightAlignedToolbarAc
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
-
- if (isIncompatibleOS()) {
- presentation.setEnabledAndVisible(false);
- return;
- }
-
CredentialedUser activeUser = GoogleLogin.getInstance().getActiveUser();
if (activeUser == null) {
presentation.setText(SIGN_IN_MESSAGE);
presentation.setIcon(GoogleLoginIcons.DEFAULT_USER_AVATAR);
- }
- else {
+ } else {
presentation.setText(activeUser.getEmail());
Image image = activeUser.getPicture();
if (image == null) {
presentation.setIcon(GoogleLoginIcons.DEFAULT_USER_AVATAR);
- }
- else {
+ } else {
Image scaledImage = image.getScaledInstance(16, 16, Image.SCALE_SMOOTH);
presentation.setIcon(new ImageIcon(scaledImage));
}
@@ -96,4 +72,3 @@ public class GoogleLoginAction extends AnAction implements RightAlignedToolbarAc
popup.showUnderneathOf(source);
}
}
-
diff --git a/google-login-plugin/testSrc/com/google/gct/login/ui/GoogleLoginActionTest.kt b/google-login-plugin/testSrc/com/google/gct/login/ui/GoogleLoginActionTest.kt
deleted file mode 100644
index 5f730b0..0000000
--- a/google-login-plugin/testSrc/com/google/gct/login/ui/GoogleLoginActionTest.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2020 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.google.gct.login.ui
-
-import com.intellij.openapi.actionSystem.AnActionEvent
-import com.intellij.openapi.actionSystem.DataContext
-import com.intellij.openapi.actionSystem.ex.ActionManagerEx
-import com.intellij.testFramework.ApplicationRule
-import com.intellij.util.Function
-import org.junit.Assert.assertFalse
-import org.junit.Assert.assertTrue
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import org.junit.runners.JUnit4
-import org.mockito.Mockito
-
-class GoogleLoginActionTest {
- /** This ensures that all the extension points are loaded. This is needed by [GoogleLoginAction.update]. */
- @get:Rule
- val appRule = ApplicationRule()
-
- private val action: GoogleLoginAction = GoogleLoginAction()
- private val actionManager: ActionManagerEx = Mockito.mock(ActionManagerEx::class.java)
- private val context: DataContext = Mockito.mock(DataContext::class.java)
- private val actionEvent: AnActionEvent
- get() = AnActionEvent(null, context, "PanPlace", action.templatePresentation.clone(), actionManager, 0)
-
- @Test
- fun testIsCompatibleOS() {
- val event = actionEvent
- action.incompatibilityOverride = Function { false }
- action.update(event)
- assertTrue(event.presentation.isEnabledAndVisible)
- }
-
- @Test
- fun testIsIncompatibleOS() {
- val event = actionEvent
- action.incompatibilityOverride = Function { true }
- action.update(event)
- assertFalse(event.presentation.isEnabledAndVisible)
- }
-} \ No newline at end of file