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

Unified Diff: blimp/client/app/android/javatests/src/org/chromium/blimp/core/BlimpContentsTest.java

Issue 2166563003: Split //blimp/client/core to relevant parts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-assignment-source
Patch Set: Created 4 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: blimp/client/app/android/javatests/src/org/chromium/blimp/core/BlimpContentsTest.java
diff --git a/blimp/client/app/android/javatests/src/org/chromium/blimp/core/BlimpContentsTest.java b/blimp/client/app/android/javatests/src/org/chromium/blimp/core/BlimpContentsTest.java
deleted file mode 100644
index f33981ec3f6865e05f751a018bbe7c4b6d87c6b9..0000000000000000000000000000000000000000
--- a/blimp/client/app/android/javatests/src/org/chromium/blimp/core/BlimpContentsTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.blimp.core;
-
-import android.test.suitebuilder.annotation.SmallTest;
-
-import org.chromium.base.ThreadUtils;
-import org.chromium.blimp.BlimpNativeInstrumentationTestCase;
-import org.chromium.blimp_public.BlimpContents;
-import org.chromium.blimp_public.BlimpNavigationController;
-import org.chromium.blimp_public.EmptyBlimpContentsObserver;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
- * Tests the basic behavior of a {@link BlimpContents}.
- */
-public class BlimpContentsTest extends BlimpNativeInstrumentationTestCase {
- private static final String EXAMPLE_URL = "https://www.example.com/";
- private static final String OTHER_EXAMPLE_URL = "https://www.otherexample.com/";
-
- private static class TestBlimpContentsObserver extends EmptyBlimpContentsObserver {
- public String url;
- @Override
- public void onUrlUpdated(String url) {
- this.url = url;
- }
- }
-
- private static void runUntilIdle() {
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {}
- });
- }
-
- @SmallTest
- public void testBasic() throws InterruptedException {
- waitUntilNativeIsReady();
-
- final AtomicReference<BlimpContents> blimpContents = new AtomicReference<>();
- final AtomicReference<BlimpNavigationController> navigationController =
- new AtomicReference<>();
- final AtomicReference<TestBlimpContentsObserver> observer1 = new AtomicReference<>();
- final AtomicReference<TestBlimpContentsObserver> observer2 = new AtomicReference<>();
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- blimpContents.set(BlimpContentsFactory.createBlimpContents());
- navigationController.set(blimpContents.get().getNavigationController());
- observer1.set(new TestBlimpContentsObserver());
- observer2.set(new TestBlimpContentsObserver());
- blimpContents.get().addObserver(observer1.get());
- blimpContents.get().addObserver(observer2.get());
-
- navigationController.get().loadUrl(EXAMPLE_URL);
- }
- });
-
- runUntilIdle();
-
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- assertEquals(EXAMPLE_URL, navigationController.get().getUrl());
- assertEquals(EXAMPLE_URL, observer1.get().url);
- assertEquals(EXAMPLE_URL, observer2.get().url);
-
- // Observer should no longer receive callbacks.
- blimpContents.get().removeObserver(observer1.get());
-
- navigationController.get().loadUrl(OTHER_EXAMPLE_URL);
- }
- });
-
- runUntilIdle();
-
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- assertEquals(OTHER_EXAMPLE_URL, navigationController.get().getUrl());
- assertEquals(EXAMPLE_URL, observer1.get().url);
- assertEquals(OTHER_EXAMPLE_URL, observer2.get().url);
-
- blimpContents.get().destroy();
- }
- });
-
- runUntilIdle();
- }
-}
« no previous file with comments | « blimp/client/BUILD.gn ('k') | blimp/client/app/android/javatests/src/org/chromium/blimp/core/contents/BlimpContentsTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698