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

Side by Side Diff: chrome/common/extensions/docs/server2/test_urlfetch.py

Issue 10689144: Extensions Docs Server: Samples zip files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up and tests Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/docs/server2/test_data/subversion_fetcher/trunk/recursive_list/list ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 import os 5 import os
6 6
7 def _ReadFile(filename): 7 def _ReadFile(filename):
8 with open(filename, 'r') as f: 8 with open(filename, 'r') as f:
9 return f.read() 9 return f.read()
10 10
11 class _MockResponse(object): 11 class _MockResponse(object):
12 def __init__(self): 12 def __init__(self):
13 self.content = '' 13 self.content = ''
14 self.headers = { 'content-type': 'none' }
14 15
15 def fetch(url): 16 def fetch(url):
16 result = _MockResponse() 17 result = _MockResponse()
18 # If a test needs to go into a directory that needs to have the same name as
19 # a file, such as the recursive directory listing subversion_fetcher_test,
20 # remove all .html's not at the end of the path.
21 url = url[:-5].replace('.html', '') + url[-5:]
17 result.content = _ReadFile(os.path.join('test_data', url)) 22 result.content = _ReadFile(os.path.join('test_data', url))
18 return result 23 return result
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/test_data/subversion_fetcher/trunk/recursive_list/list ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698