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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/WebappAuthenticatorTest.java

Issue 1214713003: Move InstrumentationTestCase tests from ChromeShell to ChromePublic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved IntentSavingContext to chrome/test to fix ChromeShell compile Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.test.InstrumentationTestCase; 8 import android.test.InstrumentationTestCase;
9 import android.test.suitebuilder.annotation.SmallTest; 9 import android.test.suitebuilder.annotation.SmallTest;
10 10
11 public class WebappAuthenticatorTest extends InstrumentationTestCase { 11 public class WebappAuthenticatorTest extends InstrumentationTestCase {
12 @SmallTest 12 @SmallTest
13 public void testAuthentication() { 13 public void testAuthentication() {
14 Context context = getInstrumentation().getTargetContext(); 14 Context context = getInstrumentation().getTargetContext();
15 String url = "http://www.example.org/hello.html"; 15 String url = "http://www.example.org/hello.html";
16 byte[] mac = WebappAuthenticator.getMacForUrl(context, url); 16 byte[] mac = WebappAuthenticator.getMacForUrl(context, url);
17 assertNotNull(mac); 17 assertNotNull(mac);
18 assertTrue(WebappAuthenticator.isUrlValid(context, url, mac)); 18 assertTrue(WebappAuthenticator.isUrlValid(context, url, mac));
19 assertFalse(WebappAuthenticator.isUrlValid(context, url + "?goats=true", mac)); 19 assertFalse(WebappAuthenticator.isUrlValid(context, url + "?goats=true", mac));
20 mac[4] += 1; 20 mac[4] += 1;
21 assertFalse(WebappAuthenticator.isUrlValid(context, url, mac)); 21 assertFalse(WebappAuthenticator.isUrlValid(context, url, mac));
22 } 22 }
23 } 23 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698