1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.server.am;
18
19import static org.junit.Assert.assertEquals;
20
21import android.app.ActivityOptions;
22import android.platform.test.annotations.Presubmit;
23import android.support.test.filters.FlakyTest;
24import android.support.test.filters.MediumTest;
25import android.support.test.runner.AndroidJUnit4;
26
27import org.junit.Test;
28import org.junit.runner.RunWith;
29
30@MediumTest
31@Presubmit
32@FlakyTest
33@RunWith(AndroidJUnit4.class)
34public class SafeActivityOptionsTest {
35
36    @Test
37    public void testMerge() {
38        final ActivityOptions opts1 = ActivityOptions.makeBasic();
39        opts1.setLaunchDisplayId(5);
40        final ActivityOptions opts2 = ActivityOptions.makeBasic();
41        opts2.setLaunchDisplayId(6);
42        final SafeActivityOptions options = new SafeActivityOptions(opts1);
43        final ActivityOptions result = options.mergeActivityOptions(opts1, opts2);
44        assertEquals(6, result.getLaunchDisplayId());
45    }
46}
47