private Pair<Uri, File> makeFile(File file, String content) throws Exception { file.deleteOnExit(); setFileContent(file, content); return Pair.of(new UriBuilder().setScheme("file").setPath(file.getPath()).toUri(), file); }
private Pair<Uri, File> makeFile(File file, String content) throws Exception { file.deleteOnExit(); setFileContent(file, content); return Pair.of(new UriBuilder().setScheme("file").setPath(file.getPath()).toUri(), file); }
private Pair<Uri, File> makeFile(File file, String content) throws Exception { file.deleteOnExit(); setFileContent(file, content); return Pair.of(new UriBuilder().setScheme("file").setPath(file.getPath()).toUri(), file); }
setFileContent(optUri.two, UPDATED_FILE_JS); loader.forceFileChanged.put(optUri.two.getAbsolutePath(), true); setFileContent(dbgUri.two, UPDATED_UNCOMPRESSED_FILE_JS); loader.forceFileChanged.put(dbgUri.two.getAbsolutePath(), true);
setFileContent(optUri.two, UPDATED_FILE_JS); loader.forceFileChanged.put(optUri.two.getAbsolutePath(), true); setFileContent(dbgUri.two, UPDATED_UNCOMPRESSED_FILE_JS); loader.forceFileChanged.put(dbgUri.two.getAbsolutePath(), true);
setFileContent(optUri.two, UPDATED_FILE_JS); loader.forceFileChanged.put(optUri.two.getAbsolutePath(), true); setFileContent(dbgUri.two, UPDATED_UNCOMPRESSED_FILE_JS); loader.forceFileChanged.put(dbgUri.two.getAbsolutePath(), true);
@Test public void loadFileUpdateIgnoredIfUpdatesDisabled() throws Exception { Pair<Uri, File> optUri = makeFile(".opt.js", FILE_JS); FeatureResource resource = loader.load(optUri.one, null); assertEquals(FILE_JS, resource.getContent()); assertEquals(FILE_JS, resource.getDebugContent()); assertFalse(resource.isExternal()); assertTrue(resource.isProxyCacheable()); setFileContent(optUri.two, UPDATED_FILE_JS); // Advance the time. Update checks disabled by default. timeSource.incrementSeconds(10); // Same asserts. assertEquals(FILE_JS, resource.getContent()); assertEquals(FILE_JS, resource.getDebugContent()); assertFalse(resource.isExternal()); assertTrue(resource.isProxyCacheable()); }
@Test public void loadFileUpdateIgnoredIfUpdatesDisabled() throws Exception { Pair<Uri, File> optUri = makeFile(".opt.js", FILE_JS); FeatureResource resource = loader.load(optUri.one, null); assertEquals(FILE_JS, resource.getContent()); assertEquals(FILE_JS, resource.getDebugContent()); assertFalse(resource.isExternal()); assertTrue(resource.isProxyCacheable()); setFileContent(optUri.two, UPDATED_FILE_JS); // Advance the time. Update checks disabled by default. timeSource.incrementSeconds(10); // Same asserts. assertEquals(FILE_JS, resource.getContent()); assertEquals(FILE_JS, resource.getDebugContent()); assertFalse(resource.isExternal()); assertTrue(resource.isProxyCacheable()); }
@Test public void loadFileUpdateIgnoredIfUpdatesDisabled() throws Exception { Pair<Uri, File> optUri = makeFile(".opt.js", FILE_JS); FeatureResource resource = loader.load(optUri.one, null); assertEquals(FILE_JS, resource.getContent()); assertEquals(FILE_JS, resource.getDebugContent()); assertFalse(resource.isExternal()); assertTrue(resource.isProxyCacheable()); setFileContent(optUri.two, UPDATED_FILE_JS); // Advance the time. Update checks disabled by default. timeSource.incrementSeconds(10); // Same asserts. assertEquals(FILE_JS, resource.getContent()); assertEquals(FILE_JS, resource.getDebugContent()); assertFalse(resource.isExternal()); assertTrue(resource.isProxyCacheable()); }