bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def WriteNamespaceClose(self, file): """Writes the code to close the namespace.""" file.Write("} // namespace gles2\n") file.Write("} // namespace gpu\n") file.Write("\n")
def WriteNamespaceClose(self, file): """Writes the code to close the namespace.""" file.Write("} // namespace gles2\n") file.Write("} // namespace gpu\n") file.Write("\n")
475,900
def WriteCommandIds(self, filename): """Writes the command buffer format""" file = CWriter(filename) self.WriteHeader(file) file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") for func in self.functions: if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) file.Write(" %-60s /* %d */ \\\n" % ("OP(%s)" % func.name, _CMD_ID_TABLE[func.name])) file.Write("\n")
def WriteCommandIds(self, filename): """Writes the command buffer format""" file = CHeaderWriter(filename) file.Write("#define GLES2_COMMAND_LIST(OP) \\\n") for func in self.functions: if not func.name in _CMD_ID_TABLE: self.Error("Command %s not in _CMD_ID_TABLE" % func.name) file.Write(" %-60s /* %d */ \\\n" % ("OP(%s)" % func.name, _CMD_ID_TABLE[func.name])) file.Write("\n")
475,901
def WriteFormat(self, filename): """Writes the command buffer format""" file = CWriter(filename) self.WriteHeader(file)
def WriteFormat(self, filename): """Writes the command buffer format""" file = CWriter(filename) self.WriteHeader(file)
475,902
def WriteFormat(self, filename): """Writes the command buffer format""" file = CWriter(filename) self.WriteHeader(file)
defWriteFormat(self,filename):"""Writesthecommandbufferformat"""file=CWriter(filename)self.WriteHeader(file)
475,903
def WriteFormatTest(self, filename): """Writes the command buffer format test.""" file = CWriter(filename) self.WriteHeader(file) file.Write("// This file contains unit tests for gles2 commmands\n") file.Write("// It is included by gles2_cmd_format_test.cc\n") file.Write("\n")
def WriteFormatTest(self, filename): """Writes the command buffer format test.""" file = CWriter(filename) self.WriteHeader(file) file.Write("// This file contains unit tests for gles2 commmands\n") file.Write("// It is included by gles2_cmd_format_test.cc\n") file.Write("\n")
475,904
def WriteCommandIdTest(self, filename): """Writes the command id test.""" file = CWriter(filename) file.Write("// This file contains unit tests for gles2 commmand ids\n") file.Write("\n")
def WriteCommandIdTest(self, filename): """Writes the command id test.""" file = CWriter(filename) file.Write("// This file contains unit tests for gles2 commmand ids\n") file.Write("\n")
475,905
def WriteCmdHelperHeader(self, filename): """Writes the gles2 command helper.""" file = CWriter(filename)
def WriteCmdHelperHeader(self, filename): """Writes the gles2 command helper.""" file = CWriter(filename)
475,906
def WriteServiceImplementation(self, filename): """Writes the service decorder implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("// It is included by gles2_cmd_decoder.cc\n") file.Write("\n")
def WriteServiceImplementation(self, filename): """Writes the service decorder implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("// It is included by gles2_cmd_decoder.cc\n") file.Write("\n")
475,907
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") file.Write("// These functions emluate GLES2 over command buffers.\n") file.Write("\n") file.Write("\n")
def WriteGLES2CLibImplementation(self, filename): """Writes the GLES2 c lib implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") file.Write("// These functions emluate GLES2 over command buffers.\n") file.Write("\n") file.Write("\n")
475,908
def WriteGLES2ImplementationHeader(self, filename): """Writes the GLES2 helper header.""" file = CWriter(filename) self.WriteHeader(file) file.Write( "// This file is included by gles2_implementation.h to declare the\n") file.Write("// GL api functions.\n") for func in self.original_functions: func.WriteGLES2ImplementationHeader(file) file.Close()
def WriteGLES2ImplementationHeader(self, filename): """Writes the GLES2 helper header.""" file = CHeaderWriter( filename, "// This file is included by gles2_implementation.h to declare the\n" "// GL api functions.\n") for func in self.original_functions: func.WriteGLES2ImplementationHeader(file) file.Close()
475,909
def WriteGLES2ImplementationImpl(self, filename): """Writes the gles2 helper implementation.""" file = CWriter(filename) self.WriteLicense(file) file.Write("\n") file.Write("// A class to emluate GLES2 over command buffers.\n") file.Write("\n") file.Write( "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") file.Write("\n") self.WriteNamespaceOpen(file) for func in self.original_functions: func.WriteGLES2ImplementationImpl(file) file.Write("\n")
def WriteGLES2ImplementationImpl(self, filename): """Writes the gles2 helper implementation.""" file = CHeaderWriter( filename, "// A class to emluate GLES2 over command buffers.\n") file.Write( "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") file.Write("\n") self.WriteNamespaceOpen(file) for func in self.original_functions: func.WriteGLES2ImplementationImpl(file) file.Write("\n")
475,910
def WriteGLES2ImplementationImpl(self, filename): """Writes the gles2 helper implementation.""" file = CWriter(filename) self.WriteLicense(file) file.Write("\n") file.Write("// A class to emluate GLES2 over command buffers.\n") file.Write("\n") file.Write( "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") file.Write("\n") self.WriteNamespaceOpen(file) for func in self.original_functions: func.WriteGLES2ImplementationImpl(file) file.Write("\n")
def WriteGLES2ImplementationImpl(self, filename): """Writes the gles2 helper implementation.""" file = CWriter(filename) self.WriteLicense(file) file.Write("// A class to emluate GLES2 over command buffers.\n") file.Write( "#include \"gpu/command_buffer/client/gles2_implementation.h\"\n") self.WriteNamespaceOpen(file) for func in self.original_functions: func.WriteGLES2ImplementationImpl(file) file.Write("\n")
475,911
def WriteServiceUtilsHeader(self, filename): """Writes the gles2 auto generated utility header.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum) file.Write("\n") file.Close()
def WriteServiceUtilsHeader(self, filename): """Writes the gles2 auto generated utility header.""" file = CHeaderWriter(filename) for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum) file.Write("\n") file.Close()
475,912
def WriteServiceUtilsHeader(self, filename): """Writes the gles2 auto generated utility header.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value);\n" % enum) file.Write("\n") file.Close()
def WriteServiceUtilsHeader(self, filename): """Writes the gles2 auto generated utility header.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool Validate%s%s(GLenum value);\n" % (_ENUM_LISTS[enum]['type'], enum)) file.Write("\n") file.Close()
475,913
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CHeaderWriter(filename) for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
475,914
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool Validate%s%s(GLenum value) {\n" % (_ENUM_LISTS[enum]['type'], enum)) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
475,915
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CWriter(filename) self.WriteHeader(file) file.Write("\n") for enum in _ENUM_LISTS: file.Write("bool ValidateGLenum%s(GLenum value) {\n" % enum) file.Write(" switch (value) {\n") for value in _ENUM_LISTS[enum]['valid']: file.Write(" case %s:\n" % value) file.Write(" return true;\n") file.Write(" default:\n") file.Write(" return false;\n") file.Write(" }\n") file.Write("}\n") file.Write("\n") file.Close()
475,916
def fix_glsl_body(body, input_mapping): # Change uniform names back to original. for match in re.findall(r'(?m)^uniform (?:\w+) (\w+)', body): body = re.sub(r'\b%s\b' % match, input_mapping[match], body) # Change attribute names back to original. for match in re.findall(r'(?m)^attribute (?:\w+) (\w+)', body): attr_name = input_mapping[match] assert attr_name.startswith('$vin.') orig_name = ATTRIBUTES_TO_SEMANTICS[attr_name[len('$vin.'):]] body = re.sub(r'\b%s\b' % match, orig_name, body) # Change vecN blah[N]; to matN blah; body = re.sub(r'(?m)^uniform vec(\d) (\w+)\[\1\];', r'uniform mat\1 \2;', body) attributes = [] if 'gl_Vertex' in body: # Change gl_Vertex to position and add attribute declaration. body = re.sub(r'\bgl_Vertex\b', 'position', body) attributes.append('attribute vec4 position;') for n in xrange(8): if 'gl_MultiTexCoord%d' % n in body: # Change gl_MultiTexCoordN (0<=N<=7) to texcoordN and add attribute # declaration. body = re.sub(r'\bgl_MultiTexCoord%d\b' % n, 'texcoord%d' % n, body) attributes.append('attribute vec4 texcoord%d;' % n) # ATTRIBUTES_TO_SEMANTICS should have taken care of normals. assert 'gl_Normal' not in body if 'gl_Position' in body: # If there is exactly one assignment to gl_Position, modify it similar to # how RewriteVertexProgramSource in gl/effect_gl.cc does it. The input is # taken from vec4 dx_clipping uniform. # # If there is more than one gl_Position mentioned in the shader, the # converter fails. assert len(re.findall('gl_Position', body)) == 1 attributes.append('vec4 _glPositionTemp;') attributes.append('uniform vec4 dx_clipping;') body = re.sub(r'\bgl_Position\b([^;]*);', r'_glPositionTemp\1; gl_Position = vec4(' + r'_glPositionTemp.x + _glPositionTemp.w * dx_clipping.x, ' + r'dx_clipping.w * ' + r'(_glPositionTemp.y + _glPositionTemp.w * dx_clipping.y), ' + r'_glPositionTemp.z * 2.0 - _glPositionTemp.w, ' + r'_glPositionTemp.w);', body) return '\n'.join(attributes) + '\n\n' + body
def fix_glsl_body(body, input_mapping): # Change uniform names back to original. for match in re.findall(r'(?m)^uniform (?:\w+) (\w+)', body): body = re.sub(r'\b%s\b' % match, input_mapping[match], body) # Change attribute names back to original. for match in re.findall(r'(?m)^attribute (?:\w+) (\w+)', body): attr_name = input_mapping[match] assert attr_name.startswith('$vin.') orig_name = ATTRIBUTES_TO_SEMANTICS[attr_name[len('$vin.'):]] body = re.sub(r'\b%s\b' % match, orig_name, body) # Change vecN blah[N]; to matN blah; body = re.sub(r'(?m)^uniform vec(\d) (\w+)\[\1\];', r'uniform mat\1 \2;', body) attributes = [] if 'gl_Vertex' in body: # Change gl_Vertex to position and add attribute declaration. body = re.sub(r'\bgl_Vertex\b', 'position', body) attributes.append('attribute vec4 position;') for n in xrange(8): if 'gl_MultiTexCoord%d' % n in body: # Change gl_MultiTexCoordN (0<=N<=7) to texcoordN and add attribute # declaration. body = re.sub(r'\bgl_MultiTexCoord%d\b' % n, 'texcoord%d' % n, body) attributes.append('attribute vec4 texcoord%d;' % n) # ATTRIBUTES_TO_SEMANTICS should have taken care of normals. assert 'gl_Normal' not in body if 'gl_Position' in body: # If there is exactly one assignment to gl_Position, modify it similar to # how RewriteVertexProgramSource in gl/effect_gl.cc does it. The input is # taken from vec4 dx_clipping uniform. # # If there is more than one gl_Position mentioned in the shader, the # converter fails. assert len(re.findall('gl_Position', body)) == 1 attributes.append('vec4 _glPositionTemp;') attributes.append('uniform vec4 dx_clipping;') body = re.sub(r'\bgl_Position\b([^;]*);', r'_glPositionTemp\1; gl_Position = vec4(' + r'_glPositionTemp.x + _glPositionTemp.w * dx_clipping.x, ' + r'dx_clipping.w * ' + r'(_glPositionTemp.y + _glPositionTemp.w * dx_clipping.y), ' + r'_glPositionTemp.z * 2.0 - _glPositionTemp.w, ' + r'_glPositionTemp.w);', body) return '\n'.join(attributes) + '\n\n' + body
475,917
def fix_glsl_body(body, input_mapping): # Change uniform names back to original. for match in re.findall(r'(?m)^uniform (?:\w+) (\w+)', body): body = re.sub(r'\b%s\b' % match, input_mapping[match], body) # Change attribute names back to original. for match in re.findall(r'(?m)^attribute (?:\w+) (\w+)', body): attr_name = input_mapping[match] assert attr_name.startswith('$vin.') orig_name = ATTRIBUTES_TO_SEMANTICS[attr_name[len('$vin.'):]] body = re.sub(r'\b%s\b' % match, orig_name, body) # Change vecN blah[N]; to matN blah; body = re.sub(r'(?m)^uniform vec(\d) (\w+)\[\1\];', r'uniform mat\1 \2;', body) attributes = [] if 'gl_Vertex' in body: # Change gl_Vertex to position and add attribute declaration. body = re.sub(r'\bgl_Vertex\b', 'position', body) attributes.append('attribute vec4 position;') for n in xrange(8): if 'gl_MultiTexCoord%d' % n in body: # Change gl_MultiTexCoordN (0<=N<=7) to texcoordN and add attribute # declaration. body = re.sub(r'\bgl_MultiTexCoord%d\b' % n, 'texcoord%d' % n, body) attributes.append('attribute vec4 texcoord%d;' % n) # ATTRIBUTES_TO_SEMANTICS should have taken care of normals. assert 'gl_Normal' not in body if 'gl_Position' in body: # If there is exactly one assignment to gl_Position, modify it similar to # how RewriteVertexProgramSource in gl/effect_gl.cc does it. The input is # taken from vec4 dx_clipping uniform. # # If there is more than one gl_Position mentioned in the shader, the # converter fails. assert len(re.findall('gl_Position', body)) == 1 attributes.append('vec4 _glPositionTemp;') attributes.append('uniform vec4 dx_clipping;') body = re.sub(r'\bgl_Position\b([^;]*);', r'_glPositionTemp\1; gl_Position = vec4(' + r'_glPositionTemp.x + _glPositionTemp.w * dx_clipping.x, ' + r'dx_clipping.w * ' + r'(_glPositionTemp.y + _glPositionTemp.w * dx_clipping.y), ' + r'_glPositionTemp.z * 2.0 - _glPositionTemp.w, ' + r'_glPositionTemp.w);', body) return '\n'.join(attributes) + '\n\n' + body
def fix_glsl_body(body, input_mapping): # Change uniform names back to original. for match in re.findall(r'(?m)^uniform (?:\w+) (\w+)', body): body = re.sub(r'\b%s\b' % match, input_mapping[match], body) # Change attribute names back to original. for match in re.findall(r'(?m)^attribute (?:\w+) (\w+)', body): attr_name = input_mapping[match] assert attr_name.startswith('$vin.') orig_name = ATTRIBUTES_TO_SEMANTICS[attr_name[len('$vin.'):]] body = re.sub(r'\b%s\b' % match, orig_name, body) # Change vecN blah[N]; to matN blah; body = re.sub(r'(?m)^uniform vec(\d) (\w+)\[\1\];', r'uniform mat\1 \2;', body) attributes = [] if 'gl_Vertex' in body: # Change gl_Vertex to position and add attribute declaration. body = re.sub(r'\bgl_Vertex\b', 'position', body) attributes.append('attribute vec4 position;') for n in xrange(8): if 'gl_MultiTexCoord%d' % n in body: # Change gl_MultiTexCoordN (0<=N<=7) to texcoordN and add attribute # declaration. body = re.sub(r'\bgl_MultiTexCoord%d\b' % n, 'texCoord%d' % n, body) attributes.append('attribute vec4 texCoord%d;' % n) # ATTRIBUTES_TO_SEMANTICS should have taken care of normals. assert 'gl_Normal' not in body if 'gl_Position' in body: # If there is exactly one assignment to gl_Position, modify it similar to # how RewriteVertexProgramSource in gl/effect_gl.cc does it. The input is # taken from vec4 dx_clipping uniform. # # If there is more than one gl_Position mentioned in the shader, the # converter fails. assert len(re.findall('gl_Position', body)) == 1 attributes.append('vec4 _glPositionTemp;') attributes.append('uniform vec4 dx_clipping;') body = re.sub(r'\bgl_Position\b([^;]*);', r'_glPositionTemp\1; gl_Position = vec4(' + r'_glPositionTemp.x + _glPositionTemp.w * dx_clipping.x, ' + r'dx_clipping.w * ' + r'(_glPositionTemp.y + _glPositionTemp.w * dx_clipping.y), ' + r'_glPositionTemp.z * 2.0 - _glPositionTemp.w, ' + r'_glPositionTemp.w);', body) return '\n'.join(attributes) + '\n\n' + body
475,918
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
475,919
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
475,920
def testZip(self): """Download a zip and verify that it downloaded correctly. Also verify that the download shelf showed up. """ test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
def testZip(self): """Download a zip and verify that it downloaded correctly. Also verify that the download shelf showed up. """ test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
475,921
def testZipInIncognito(self): """Download and verify a zip in incognito window.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
def testZipInIncognito(self): """Download and verify a zip in incognito window.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
475,922
def testSaveDangerousFile(self): """Verify that we can download and save a dangerous file.""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
def testSaveDangerousFile(self): """Verify that we can download and save a dangerous file.""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
475,923
def testDeclineDangerousDownload(self): """Verify that we can decline dangerous downloads""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
def testDeclineDangerousDownload(self): """Verify that we can decline dangerous downloads""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
475,924
def testRemoveDownload(self): """Verify that we can remove a download.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
def testRemoveDownload(self): """Verify that we can remove a download.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
475,925
def testBigZip(self): """Verify that we can download a 1GB file.
def testBigZip(self): """Verify that we can download a 1GB file.
475,926
def testFileRenaming(self): """Test file renaming when downloading a already-existing filename.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_url = 'file://%s' % os.path.join(test_dir, 'a_zip_file.zip') download_dir = self.GetDownloadDirectory().value()
def testFileRenaming(self): """Test file renaming when downloading a already-existing filename.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_url = 'file://%s' % os.path.join(test_dir, 'a_zip_file.zip') download_dir = self.GetDownloadDirectory().value()
475,927
def _CreateFile(name): """Create and fill the given file with some junk.""" fp = open(name, 'w') # name could be unicode print >>fp, 'This is a junk file named %s. ' % repr(name) * 100 fp.close()
def _CreateFile(name): """Create and fill the given file with some junk.""" fp = open(name, 'w') # name could be unicode print >>fp, 'This is a junk file named %s. ' % repr(name) * 100 fp.close()
475,928
def testNoUnsafeDownloadsOnRestart(self): """Verify that unsafe file should not show up on session restart.""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self.assertTrue(self.IsDownloadShelfVisible()) # Restart the browser and assert that the download was removed. self.RestartBrowser(clear_profile=False) self.assertFalse(os.path.exists(downloaded_pkg)) self.assertFalse(self.IsDownloadShelfVisible()) self.NavigateToURL("chrome://downloads") self.assertFalse(self.GetDownloadsInfo().Downloads())
def testNoUnsafeDownloadsOnRestart(self): """Verify that unsafe file should not show up on session restart.""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) self._ClearLocalDownloadState(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self.assertTrue(self.IsDownloadShelfVisible()) # Restart the browser and assert that the download was removed. self.RestartBrowser(clear_profile=False) self.assertFalse(os.path.exists(downloaded_pkg)) self.assertFalse(self.IsDownloadShelfVisible()) self.NavigateToURL("chrome://downloads") self.assertFalse(self.GetDownloadsInfo().Downloads())
475,929
def testPauseAndResume(self): """Verify that pause and resume work while downloading a file.
def testPauseAndResume(self): """Verify that pause and resume work while downloading a file.
475,930
def testCancelDownload(self): """Verify that we can cancel a download.""" # Create a big file (250 MB) on the fly, so that the download won't finish # before being cancelled. file_path = self._MakeFile(2**28) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self.PerformActionOnDownload(self._GetDownloadId(), 'cancel') self._DeleteAfterShutdown(file_path)
def testCancelDownload(self): """Verify that we can cancel a download.""" # Create a big file (250 MB) on the fly, so that the download won't finish # before being cancelled. file_path = self._MakeFile(2**28) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) self._ClearLocalDownloadState(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self.PerformActionOnDownload(self._GetDownloadId(), 'cancel') self._DeleteAfterShutdown(file_path)
475,931
def testDownloadsPersistence(self): """Verify that download history persists on session restart.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(1, len(downloads)) self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) file_url = downloads[0]['url'] self.RestartBrowser(clear_profile=False) # Trigger the download service to get loaded after restart. self.NavigateToURL('chrome://downloads/') # Verify that there's no download shelf anymore. self.assertFalse(self.IsDownloadShelfVisible(), 'Download shelf persisted browser restart.') # Verify that the download history persists. downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(1, len(downloads)) self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) self.assertEqual(file_url, downloads[0]['url']) self._DeleteAfterShutdown(downloaded_pkg)
def testDownloadsPersistence(self): """Verify that download history persists on session restart.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file.zip') self._ClearLocalDownloadState(downloaded_pkg) self.DownloadAndWaitForStart(file_url) downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(1, len(downloads)) self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) file_url = downloads[0]['url'] self.RestartBrowser(clear_profile=False) # Trigger the download service to get loaded after restart. self.NavigateToURL('chrome://downloads/') # Verify that there's no download shelf anymore. self.assertFalse(self.IsDownloadShelfVisible(), 'Download shelf persisted browser restart.') # Verify that the download history persists. downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(1, len(downloads)) self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) self.assertEqual(file_url, downloads[0]['url']) self._DeleteAfterShutdown(downloaded_pkg)
475,932
def testDownloadTheme(self): """Verify downloading and saving a theme file installs the theme.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'extensions') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'theme.crx')) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'theme.crx') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
def testDownloadTheme(self): """Verify downloading and saving a theme file installs the theme.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'extensions') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'theme.crx')) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'theme.crx') os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
475,933
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version: %s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_NPAPI_FILENAME = FLAGS.set_npapi_filename O3D_PLUGIN_NPAPI_MIMETYPE = FLAGS.set_npapi_mimetype O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID = FLAGS.set_activex_hostcontrol_clsid O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID = FLAGS.set_activex_typelib_clsid O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME = FLAGS.set_activex_hostcontrol_name O3D_PLUGIN_ACTIVEX_TYPELIB_NAME = FLAGS.set_activex_typelib_name if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginNpapiFilename@@@', O3D_PLUGIN_NPAPI_FILENAME), ('@@@PluginNpapiMimeType@@@', O3D_PLUGIN_NPAPI_MIMETYPE), ('@@@PluginActiveXHostControlClsid@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID), ('@@@PluginActiveXTypeLibClsid@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID), ('@@@PluginActiveXHostControlName@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME), ('@@@PluginActiveXTypeLibName@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_NAME), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
def main(argv): try: files = FLAGS(argv) # Parse flags except gflags.FlagsError, e: print '%s.\nUsage: %s [<options>] [<input_file> <output_file>]\n%s' % \ (e, sys.argv[0], FLAGS) sys.exit(1) # Strip off argv[0] files = files[1:] # Get version string from o3d_version.py o3d_version_vars = {} if FLAGS.kill_switch: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_kill_version.py'), o3d_version_vars) else: execfile(os.path.join(script_dir, '..', 'installer', 'win', 'o3d_version.py'), o3d_version_vars) plugin_version = o3d_version_vars['plugin_version'] sdk_version = o3d_version_vars['sdk_version'] # This name is used by Javascript to find the plugin therefore it must # not change. If you change this you must change the name in # samples/o3djs/util.js but be aware, changing the name # will break all apps that use o3d on the web. O3D_PLUGIN_NAME = FLAGS.set_name O3D_PLUGIN_VERSION = GetDotVersion(plugin_version) O3D_PLUGIN_VERSION_COMMAS = GetCommaVersion(plugin_version) O3D_SDK_VERSION = GetDotVersion(sdk_version) O3D_SDK_VERSION_COMMAS = GetCommaVersion(sdk_version) O3D_PLUGIN_DESCRIPTION = '%s version:%s' % (O3D_PLUGIN_NAME, O3D_PLUGIN_VERSION) O3D_PLUGIN_NPAPI_FILENAME = FLAGS.set_npapi_filename O3D_PLUGIN_NPAPI_MIMETYPE = FLAGS.set_npapi_mimetype O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID = FLAGS.set_activex_hostcontrol_clsid O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID = FLAGS.set_activex_typelib_clsid O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME = FLAGS.set_activex_hostcontrol_name O3D_PLUGIN_ACTIVEX_TYPELIB_NAME = FLAGS.set_activex_typelib_name if FLAGS.description: print '%s' % O3D_PLUGIN_DESCRIPTION sys.exit(0) if FLAGS.version: print '%s' % O3D_PLUGIN_VERSION sys.exit(0) if FLAGS.commaversion: print '%s' % O3D_PLUGIN_VERSION_COMMAS sys.exit(0) plugin_replace_strings = [ ('@@@PluginName@@@', O3D_PLUGIN_NAME), ('@@@ProductVersionCommas@@@', O3D_PLUGIN_VERSION_COMMAS), ('@@@ProductVersion@@@', O3D_PLUGIN_VERSION), ('@@@PluginDescription@@@', O3D_PLUGIN_DESCRIPTION), ('@@@PluginNpapiFilename@@@', O3D_PLUGIN_NPAPI_FILENAME), ('@@@PluginNpapiMimeType@@@', O3D_PLUGIN_NPAPI_MIMETYPE), ('@@@PluginActiveXHostControlClsid@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_CLSID), ('@@@PluginActiveXTypeLibClsid@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_CLSID), ('@@@PluginActiveXHostControlName@@@', O3D_PLUGIN_ACTIVEX_HOSTCONTROL_NAME), ('@@@PluginActiveXTypeLibName@@@', O3D_PLUGIN_ACTIVEX_TYPELIB_NAME), ] if len(files) == 2: DoReplace(files[0], files[1], plugin_replace_strings) elif len(files) > 0: raise Exception(r'You must supply and input and output filename for ' r'replacement.')
475,934
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name"); generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None; if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result); if (original and result == original): return None else: return input_file
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None; if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result); if (original and result == original): return None else: return input_file
475,935
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name"); generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None; if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result); if (original and result == original): return None else: return input_file
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name"); generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result); if (original and result == original): return None else: return input_file
475,936
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name"); generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None; if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result); if (original and result == original): return None else: return input_file
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name"); generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None; if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # the remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) result = result[content_start:content_end + len(_expected_output_postamble)] + "\n" # remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
475,937
def GetStaticFileNames(): static_files = os.listdir(_static_dir) return set(os.path.splitext(file)[0] for file in static_files if file.endswith(".html"))
def GetStaticFileNames(): static_files = os.listdir(_static_dir) return set(os.path.splitext(file_name)[0] for file_name in static_files if file_name.endswith(".html"))
475,938
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
475,939
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
475,940
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1) debug_log = os.path.normpath(_build_dir + "/" + "debug.log") if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
475,941
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return 0;
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script."); parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f; # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1); debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); if (os.path.isfile(debug_log)): os.remove(debug_log) return os.EX_OK
475,942
def main_linux(options, args): # minidump_stackwalk is part of Google Breakpad. You may need to checkout # the code and build your own copy. http://google-breakpad.googlecode.com/ LINUX_PROCESSOR = 'minidump_stackwalk' processor_bin = None if options.processor_dir: bin = os.path.join(os.path.expanduser(options.processor_dir), LINUX_PROCESSOR) if os.access(bin, os.X_OK): processor_bin = bin else: for path in os.environ['PATH'].split(':'): bin = os.path.join(path, LINUX_PROCESSOR) if os.access(bin, os.X_OK): processor_bin = bin break if not processor_bin: print 'Cannot find minidump_stackwalk.' return 1 if options.architecture: bits = options.architecture else: bits = struct.calcsize('P') * 8 if bits == 32: symbol_file = 'chrome.breakpad.ia32' elif bits == 64: symbol_file = 'chrome.breakpad.ia64' else: print 'Unknown architecture' return 1 symbol_dir = options.symbol_dir if not options.symbol_dir: symbol_dir = os.curdir symbol_dir = os.path.abspath(os.path.expanduser(symbol_dir)) symbol_file = os.path.join(symbol_dir, symbol_file) if not os.path.exists(symbol_file): print 'Cannot find symbols.' return 1 symbol_time = os.path.getmtime(symbol_file) dump_files = [] if options.dump_file: dump_files.append(options.dump_file) else: dump_dir = options.dump_dir if not dump_dir: dump_dir = GetCrashDumpDir() if not dump_dir: print 'Cannot find dump files.' return 1 for dump_file in LocateFiles(pattern='*.dmp', root=dump_dir): file_time = os.path.getmtime(dump_file) if file_time < symbol_time: # Ignore dumps older than symbol file. continue dump_files.append(dump_file) temp_dir = tempfile.mkdtemp(suffix='chromedump') if not VerifySymbolAndCopyToTempDir(symbol_file, temp_dir): print 'Cannot parse symbols.' shutil.rmtree(temp_dir) return 1 dump_count = 0 for dump_file in dump_files: processed_dump_file = ProcessDump(dump_file, temp_dir) if not processed_dump_file: continue print '-------------------------' print GetStackTrace(processor_bin, temp_dir, processed_dump_file) print os.remove(processed_dump_file) dump_count += 1 shutil.rmtree(temp_dir) print '%s dumps found' % dump_count return 0
def main_linux(options, args): # minidump_stackwalk is part of Google Breakpad. You may need to checkout # the code and build your own copy. http://google-breakpad.googlecode.com/ LINUX_PROCESSOR = 'minidump_stackwalk' processor_bin = None if options.processor_dir: bin = os.path.join(os.path.expanduser(options.processor_dir), LINUX_PROCESSOR) if os.access(bin, os.X_OK): processor_bin = bin else: for path in os.environ['PATH'].split(':'): bin = os.path.join(path, LINUX_PROCESSOR) if os.access(bin, os.X_OK): processor_bin = bin break if not processor_bin: print 'Cannot find minidump_stackwalk.' return 1 if options.architecture: bits = options.architecture else: bits = struct.calcsize('P') * 8 if bits == 32: symbol_file = 'chrome.breakpad.ia32' elif bits == 64: symbol_file = 'chrome.breakpad.x64' else: print 'Unknown architecture' return 1 symbol_dir = options.symbol_dir if not options.symbol_dir: symbol_dir = os.curdir symbol_dir = os.path.abspath(os.path.expanduser(symbol_dir)) symbol_file = os.path.join(symbol_dir, symbol_file) if not os.path.exists(symbol_file): print 'Cannot find symbols.' return 1 symbol_time = os.path.getmtime(symbol_file) dump_files = [] if options.dump_file: dump_files.append(options.dump_file) else: dump_dir = options.dump_dir if not dump_dir: dump_dir = GetCrashDumpDir() if not dump_dir: print 'Cannot find dump files.' return 1 for dump_file in LocateFiles(pattern='*.dmp', root=dump_dir): file_time = os.path.getmtime(dump_file) if file_time < symbol_time: # Ignore dumps older than symbol file. continue dump_files.append(dump_file) temp_dir = tempfile.mkdtemp(suffix='chromedump') if not VerifySymbolAndCopyToTempDir(symbol_file, temp_dir): print 'Cannot parse symbols.' shutil.rmtree(temp_dir) return 1 dump_count = 0 for dump_file in dump_files: processed_dump_file = ProcessDump(dump_file, temp_dir) if not processed_dump_file: continue print '-------------------------' print GetStackTrace(processor_bin, temp_dir, processed_dump_file) print os.remove(processed_dump_file) dump_count += 1 shutil.rmtree(temp_dir) print '%s dumps found' % dump_count return 0
475,943
def testPerfExpectations(self): perf_data = LoadData()
def testPerfExpectations(self): perf_data = LoadData()
475,944
def __init__(self, source_dir, files): '''Reads in a set of files.
def __init__(self, source_dir, files): '''Reads in a set of files.
475,945
def ParseReportFile(self, filename): self.cur_fd_ = open(filename, 'r')
def ParseReportFile(self, filename): self.cur_fd_ = open(filename, 'r')
475,946
def Report(self, check_sanity): sys.stdout.flush() #TODO(timurrrr): support positive tests / check_sanity==True
def Report(self, check_sanity): sys.stdout.flush() #TODO(timurrrr): support positive tests / check_sanity==True
475,947
def SimpleTest(self, module, name, valgrind_test_args=None, cmd_args=None): cmd = self._DefaultCommand(module, name, valgrind_test_args) self._ReadGtestFilterFile(name, cmd) if cmd_args: cmd.extend(["--"]) cmd.extend(cmd_args)
def SimpleTest(self, module, name, valgrind_test_args=None, cmd_args=None): cmd = self._DefaultCommand(module, name, valgrind_test_args) self._ReadGtestFilterFile(name, cmd) if cmd_args: cmd.extend(["--"]) cmd.extend(cmd_args)
475,948
def CheckUnittestsRan(input_api, output_api, committing): '''Checks that the unittests success file is newer than any modified file''' # But only if there were IE files modified, since we only have unit tests # for CEEE IE. files = [] for f in input_api.AffectedFiles(include_deletes = False): path = f.LocalPath() if path.startswith('ie\\') or path.startswith('common\\'): files.append(f) if not files: return [] def MakeResult(message, modified_files=[]): if committing: return output_api.PresubmitError(message, modified_files) else: return output_api.PresubmitNotifyResult(message, modified_files) os_path = input_api.os_path success_files = [ os_path.join(input_api.PresubmitLocalPath(), '../chrome/Debug/ceee.success'), os_path.join(input_api.PresubmitLocalPath(), '../chrome/Release/ceee.success')] if (not os_path.exists(success_files[0]) or not os_path.exists(success_files[1])): return [MakeResult(_UNITTEST_MESSAGE)] success_time = min(os.stat(success_files[0]).st_mtime, os.stat(success_files[1]).st_mtime) modified_files = [] for f in modified_files: file_time = os.stat(f.AbsoluteLocalPath()).st_mtime if file_time > success_time: modified_files.append(f.LocalPath()) result = [] if modified_files: result.append(MakeResult('These files have been modified since Debug and/or' ' Release unittests were built.', modified_files)) return result
def CheckUnittestsRan(input_api, output_api, committing): '''Checks that the unittests success file is newer than any modified file''' # But only if there were IE files modified, since we only have unit tests # for CEEE IE. files = [] for f in input_api.AffectedFiles(include_deletes = False): path = f.LocalPath() if (ie_paths_re.match(path)): files.append(f) if not files: return [] def MakeResult(message, modified_files=[]): if committing: return output_api.PresubmitError(message, modified_files) else: return output_api.PresubmitNotifyResult(message, modified_files) os_path = input_api.os_path success_files = [ os_path.join(input_api.PresubmitLocalPath(), '../chrome/Debug/ceee.success'), os_path.join(input_api.PresubmitLocalPath(), '../chrome/Release/ceee.success')] if (not os_path.exists(success_files[0]) or not os_path.exists(success_files[1])): return [MakeResult(_UNITTEST_MESSAGE)] success_time = min(os.stat(success_files[0]).st_mtime, os.stat(success_files[1]).st_mtime) modified_files = [] for f in modified_files: file_time = os.stat(f.AbsoluteLocalPath()).st_mtime if file_time > success_time: modified_files.append(f.LocalPath()) result = [] if modified_files: result.append(MakeResult('These files have been modified since Debug and/or' ' Release unittests were built.', modified_files)) return result
475,949
def GetGClientBranchName(): """Returns the name of the magic branch that lets us know that DEPS is managing the update cycle.""" # Is there an override branch specified? overide_config_name = 'chromium.sync-branch' override_branch_name = RunGit(['config', '--get', overide_config_name]) if not override_branch_name: return 'refs/heads/gclient' # No override, so return the default branch. # Verify that the branch from config exists. ref_branch = 'refs/heads/' + override_branch_name current_head = RunGit(['show-ref', '--hash', ref_branch]) if current_head: return ref_branch # Inform the user about the problem and how to fix it. print ("The specified override branch ('%s') doesn't appear to exist." % override_branch_name) print "Please fix your git config value '%s'." % overide_config_name sys.exit(1)
def GetGClientBranchName(): """Returns the name of the magic branch that lets us know that DEPS is managing the update cycle.""" # Is there an override branch specified? override_branch_name = GetOverrideShortBranchName() if not override_branch_name: return 'refs/heads/gclient' # No override, so return the default branch. # Verify that the branch from config exists. ref_branch = 'refs/heads/' + override_branch_name current_head = RunGit(['show-ref', '--hash', ref_branch]) if current_head: return ref_branch # Inform the user about the problem and how to fix it. print ("The specified override branch ('%s') doesn't appear to exist." % override_branch_name) print "Please fix your git config value '%s'." % overide_config_name sys.exit(1)
475,950
def UpdateGClientBranch(webkit_rev, magic_gclient_branch): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', magic_gclient_branch]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', magic_gclient_branch, target], shell=(os.name == 'nt')) return True
def UpdateGClientBranch(webkit_rev, magic_gclient_branch): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch', GetRemote()], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', magic_gclient_branch]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', magic_gclient_branch, target], shell=(os.name == 'nt')) return True
475,951
def __str__(self): ''' Pretty print the type and backtrace(s) of this specific error, including suppression (which is just a mangled backtrace).''' output = "" if (self._commandline): output += self._commandline + "\n"
def __str__(self): ''' Pretty print the type and backtrace(s) of this specific error, including suppression (which is just a mangled backtrace).''' output = "" if (self._commandline): output += self._commandline + "\n"
475,952
def Report(self, files, check_sanity=False): '''Reads in a set of files and prints Memcheck report.
def Report(self, files, check_sanity=False): '''Reads in a set of files and prints Memcheck report.
475,953
def testSetTheme(self): """Verify theme install.""" self.assertFalse(self.GetThemeInfo()) # Verify there's no theme at startup crx_file = os.path.join(self.DataDir(), 'extensions', 'theme.crx') self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file))) theme = self.GetThemeInfo() self.assertEqual('camo theme', theme['name']) # TODO: verify "theme installed" infobar
def testSetTheme(self): """Verify theme install.""" self.assertFalse(self.GetThemeInfo()) # Verify there's no theme at startup crx_file = os.path.abspath( os.path.join(self.DataDir(), 'extensions', 'theme.crx')) self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file))) theme = self.GetThemeInfo() self.assertEqual('camo theme', theme['name']) # TODO: verify "theme installed" infobar
475,954
def testThemeReset(self): """Verify theme reset.""" crx_file = os.path.join(self.DataDir(), 'extensions', 'theme.crx') self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file))) self.assertTrue(self.ResetToDefaultTheme()) self.assertFalse(self.GetThemeInfo())
def testThemeReset(self): """Verify theme reset.""" crx_file = os.path.abspath( os.path.join(self.DataDir(), 'extensions', 'theme.crx')) self.assertTrue(self.SetTheme(pyauto.FilePath(crx_file))) self.assertTrue(self.ResetToDefaultTheme()) self.assertFalse(self.GetThemeInfo())
475,955
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues() for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" gl_error = None count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result, gl_error) = arg.GetInvalidArg( count, value_index) else: arg_string = arg.GetValidArg(count, 0) arg_strings.append(arg_string) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append("_") count += 1 gl_func_name = func.GetGLTestFunctionName() gl_error_test = '' if not gl_error == None: gl_error_test = '\n EXPECT_EQ(%s, GetGLError());' % gl_error
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues(func) for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" gl_error = None count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result, gl_error) = arg.GetInvalidArg( count, value_index) else: arg_string = arg.GetValidArg(count, 0) arg_strings.append(arg_string) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append("_") count += 1 gl_func_name = func.GetGLTestFunctionName() gl_error_test = '' if not gl_error == None: gl_error_test = '\n EXPECT_EQ(%s, GetGLError());' % gl_error
475,956
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
475,957
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
475,958
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n")
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) arg_string = func.MakeOriginalArgString("") comma = "" if len(arg_string) > 0: comma = ", " file.Write(" helper_->%s(%s%sresult_shm_id(), result_shm_offset());\n" % (func.name, arg_string, comma)) file.Write(" WaitForCmd();\n") file.Write(" return GetResultAs<%s>();\n" % func.return_type) file.Write("}\n") file.Write("\n")
475,959
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): Implement this\n") TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): Implement this\n") TypeHandler.WriteGLES2ImplementationHeader(self, func, file)
475,960
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name)
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" file.Write("// TODO(gman): %s\n\n" % func.name)
475,961
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetCmdArgs() id_arg = args[0] bucket_arg = args[1] id_arg.WriteGetCode(file) bucket_arg.WriteGetCode(file) id_arg.WriteValidationCode(file) file.Write(" GLint len = 0;\n") file.Write(" %s(%s, %s, &len);\n" % ( func.GetInfo('get_len_func'), id_arg.name, func.GetInfo('get_len_enum'))) file.Write(" Bucket* bucket = CreateBucket(%s);\n" % bucket_arg.name) file.Write(" bucket->SetSize(len + 1);\n"); file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
475,962
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s %s = GetSharedMemoryAs<%s>(\n" % (dest_arg.type, dest_arg.name, dest_arg.type)) file.Write( " c.%s_shm_id, c.%s_shm_offset, %s);\n" % (dest_arg.name, dest_arg.name, bufsize_arg.name)) for arg in all_but_last_2_args + [dest_arg]: arg.WriteValidationCode(file) func.WriteValidationCode(file) func.WriteHandlerImplementation(file) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) args = func.GetOriginalArgs() all_but_last_2_args = args[:-2] for arg in all_but_last_2_args: arg.WriteGetCode(file) self.WriteGetDataSizeCode(func, file) size_arg = args[-2] file.Write(" uint32 size_shm_id = c.%s_shm_id;\n" % size_arg.name) file.Write(" uint32 size_shm_offset = c.%s_shm_offset;\n" % size_arg.name) file.Write(" GLsizei* length = NULL;\n") file.Write(" if (size_shm_id != 0 || size_shm_offset != 0) {\n" " length = GetSharedMemoryAs<GLsizei*>(\n" " size_shm_id, size_shm_offset, sizeof(*length));\n" " if (!length) {\n" " return error::kOutOfBounds;\n" " }\n" " }\n") dest_arg = args[-1] bufsize_arg = args[-3] file.Write( " %s(%s, len + 1, &len, bucket->GetDataAs<GLchar*>(0, len + 1));\n" % (func.GetGLFunctionName(), id_arg.name)) file.Write(" return error::kNoError;\n") file.Write("}\n") file.Write("\n")
475,963
def GetNumInvalidValues(self): """returns the number of invalid values to be tested.""" return 0
def GetNumInvalidValues(self, func): """returns the number of invalid values to be tested.""" return 0
475,964
def WriteValidationCode(self, file): """Writes the validation code for an argument.""" if self.type == 'GLsizei' or self.type == 'GLsizeiptr': file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
def WriteValidationCode(self, file): """Writes the validation code for an argument.""" if self.type == 'GLsizei' or self.type == 'GLsizeiptr': file.Write(" if (%s < 0) {\n" % self.name) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n")
475,965
def GetNumInvalidValues(self): """overridden from Argument.""" return 1
def GetNumInvalidValues(self, func): """overridden from Argument.""" return 1
475,966
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
def GetInvalidArg(self, offset, index): """overridden from Argument.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
475,967
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
def GetInvalidArg(self, offset, index): """returns an invalid value and expected parse result by index.""" return ("-1", "kNoError", "GL_INVALID_VALUE")
475,968
def GetNumInvalidValues(self): """returns the number of invalid values to be tested.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] return len(invalid) return 0
def GetNumInvalidValues(self, func): """returns the number of invalid values to be tested.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] return len(invalid) return 0
475,969
def GetInvalidArg(self, offset, index): """returns an invalid value by index.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] num_invalid = len(invalid) if index >= num_invalid: index = num_invalid - 1 return (invalid[index], "kNoError", "GL_INVALID_ENUM") return ("---ERROR1---", "kNoError", "GL_INVALID_ENUM")
def GetInvalidArg(self, offset, index): """returns an invalid value by index.""" if 'invalid' in self.enum_info: invalid = self.enum_info['invalid'] num_invalid = len(invalid) if index >= num_invalid: index = num_invalid - 1 return (invalid[index], "kNoError", "GL_INVALID_ENUM") return ("---ERROR1---", "kNoError", "GL_INVALID_ENUM")
475,970
def GetNumInvalidValues(self): """Overridden from Argument.""" return 2
def GetNumInvalidValues(self, func): """Overridden from Argument.""" return 2
475,971
def ToTclibMessage(self): msg = grit.extern.tclib.Message( 'utf-8', id=self.id, meaning=self.meaning) self.FillTclibBaseMessage(msg) return msg
def ToTclibMessage(self): msg = grit.extern.tclib.Message( 'utf-8', id=self.id, meaning=self.meaning) self.FillTclibBaseMessage(msg) return msg
475,972
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") if webgl_mode: output_file.write(" '../o3d_assets/samples/%s.fake_webgl_input.txt',\n" % asset['path']) else: output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") if webgl_mode: output_file.write(" '../o3d_assets/samples/%s.fake_webgl_input.txt',\n" % asset['path']) else: output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
475,973
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
475,974
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
475,975
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
475,976
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=180000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=240000", "--ui-test-action-timeout=120000", "--ui-test-action-max-timeout=180000", "--ui-test-sleep-timeout=120000", "--ui-test-terminate-timeout=120000"])
def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=180000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=240000", "--ui-test-action-timeout=120000", "--ui-test-action-max-timeout=280000", "--ui-test-sleep-timeout=120000", "--ui-test-terminate-timeout=120000"])
475,977
def __init__(self, solution, projects, tests): self._projects = projects self._tests = tests self._saved_autohides = None self._solution = win32com.client.GetObject(solution) self._dte = self._GetDte(self._solution)
def__init__(self,solution,projects,tests):self._projects=projectsself._tests=testsself._saved_autohides=Noneself._solution=win32com.client.GetObject(solution)self._dte=self._GetDte(self._solution)
475,978
def _GetDte(self, solution): '''Sometimes invoking solution.DTE will fail with an exception during Visual Studio initialization. To work around this, we try a couple of times with an intervening sleep to give VS time to settle.''' # Attempt ten times under a try block. for i in range(0, 10): try: return solution.DTE except pythoncom.com_error, e: # Sleep for 2 seconds print 'Exception from solution.DTE "%s", retrying: ' % str(e) time.sleep(2.0)
def _GetDte(self, solution): '''Sometimes invoking solution.DTE will fail with an exception during Visual Studio initialization. To work around this, we try a couple of times with an intervening sleep to give VS time to settle.''' # Attempt ten times under a try block. for i in range(0, 10): try: return solution.DTE except pythoncom.com_error, e: # Sleep for 2 seconds print 'Exception from solution.DTE "%s", retrying: ' % str(e) time.sleep(2.0)
475,979
def BuildConfig(self, config): '''Builds all projects for a given config.
def BuildConfig(self, config): '''Builds all projects for a given config.
475,980
def Main(): if not ctypes.windll.shell32.IsUserAnAdmin(): print ("Please run the smoke tests in an admin prompt " "(or AppVerifier won't work).") return 1 runner = TestRunner(_CHROME_SOLUTION, _PROJECTS_TO_BUILD, _TESTS_TO_RUN) failures = 0 for config in _CONFIGURATIONS: failures += runner.BuildConfig(config) if failures != 0: print '%d build errors' % failures return failures for config in _CONFIGURATIONS: failures += runner.RunConfigTests(config) if failures != 0: print '%d unittests failed' % failures return failures
def Main(): if not ctypes.windll.shell32.IsUserAnAdmin(): print ("Please run the smoke tests in an admin prompt " "(or AppVerifier won't work).") return 1 parser = GetOptionParser() (options, args) = parser.parse_args() if args: parser.error('This script takes no arguments') solution = options.solution if not os.path.exists(solution): solution = os.path.join(os.path.dirname(_CHROME_SOLUTION), solution) solution = solution + '.sln' solution = os.path.abspath(solution) runner = TestRunner(solution, _PROJECTS_TO_BUILD, _TESTS_TO_RUN) failures = 0 for config in _CONFIGURATIONS: failures += runner.BuildConfig(config) if failures != 0: print '%d build errors' % failures return failures for config in _CONFIGURATIONS: failures += runner.RunConfigTests(config) if failures != 0: print '%d unittests failed' % failures return failures
475,981
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData' or name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
475,982
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif (name == 'CompressedTexImage2D' or name == 'CompressedTexSubImage2D'): file.Write(" uint32 data_size = imageSize;\n") elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
475,983
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size; if (!GLES2Util::ComputeImageDataSize( width, height, format, type, unpack_alignment_, &data_size)) { return error::kOutOfBounds; } """ file.Write(code) else: file.Write("// uint32 data_size = 0; // TODO(gman): get correct size!\n")
475,984
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
475,985
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = n * sizeof(GLuint);\n")
475,986
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg()
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg()
475,987
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count))
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count))
475,988
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count))
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count))
475,989
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) {
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) {
475,990
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) {
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) {
475,991
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
475,992
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
475,993
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
def testAlwaysOpenFileType(self): """Verify "Always Open Files of this Type" download option
475,994
def testDownloadPercentage(self): """Verify that during downloading, % values increases, and once download is over, % value is 100""" file_path = self._MakeFile(2**24) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) downloads = self.GetDownloadsInfo().Downloads() old_percentage = downloads[0]['PercentComplete'] # Wait for some time again re-check the download percentage time.sleep(1) downloads = self.GetDownloadsInfo().Downloads() percentage = downloads[0]['PercentComplete'] self.assertTrue(percentage > old_percentage, 'Download percentage value is not increasing') # Once download is completed, percentage is 100 self.WaitForAllDownloadsToComplete() downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(downloads[0]['PercentComplete'], 100, 'Download percentage should be 100 after download completed') os.path.exists(file_path) and os.remove(file_path) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
def testDownloadPercentage(self): """Verify that during downloading, % values increases, and once download is over, % value is 100""" file_path = self._MakeFile(2**24) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) downloads = self.GetDownloadsInfo().Downloads() old_percentage = downloads[0]['PercentComplete'] # Wait for some time again re-check the download percentagedef _PercentInc(): percent = self.GetDownloadsInfo().Downloads()[0]['PercentComplete'] return old_percentage == 100 or percent > old_percentage, self.assertTrue(self.WaitUntil(_PercentInc), msg='Download percentage value is not increasing') # Once download is completed, percentage is 100 self.WaitForAllDownloadsToComplete() downloads = self.GetDownloadsInfo().Downloads() self.assertEqual(downloads[0]['PercentComplete'], 100, 'Download percentage should be 100 after download completed') os.path.exists(file_path) and os.remove(file_path) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
475,995
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Parse metadata fields out of README.chromium. # We examine "LICENSE" for the license file by default. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } if path in SPECIAL_CASES: metadata.update(SPECIAL_CASES[path]) else: # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") for line in open(readme_path): line = line.strip() if not line: break for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium or licences.py " "SPECIAL_CASES") # Check that the license file exists. for filename in (metadata["License File"], "COPYING"): license_path = os.path.join(path, filename) if os.path.exists(license_path): metadata["License File"] = filename break license_path = None if not license_path: raise LicenseError("License file not found. " "Either add a file named LICENSE, " "import upstream's COPYING if available, " "or add a 'License File:' line to README.chromium " "with the appropriate path.") return metadata
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Parse metadata fields out of README.chromium. # We examine "LICENSE" for the license file by default. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } if path in SPECIAL_CASES: metadata.update(SPECIAL_CASES[path]) else: # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") for line in open(readme_path): line = line.strip() if not line: break for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium or licences.py " "SPECIAL_CASES") # Check that the license file exists. for filename in (metadata["License File"], "COPYING"): if filename.startswith('/'): license_path = os.path.join(os.getcwd(), filename[1:]) else: license_path = os.path.join(path, filename) if os.path.exists(license_path): metadata["License File"] = filename break license_path = None if not license_path: raise LicenseError("License file not found. " "Either add a file named LICENSE, " "import upstream's COPYING if available, " "or add a 'License File:' line to README.chromium " "with the appropriate path.") return metadata
475,996
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Parse metadata fields out of README.chromium. # We examine "LICENSE" for the license file by default. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } if path in SPECIAL_CASES: metadata.update(SPECIAL_CASES[path]) else: # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") for line in open(readme_path): line = line.strip() if not line: break for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium or licences.py " "SPECIAL_CASES") # Check that the license file exists. for filename in (metadata["License File"], "COPYING"): license_path = os.path.join(path, filename) if os.path.exists(license_path): metadata["License File"] = filename break license_path = None if not license_path: raise LicenseError("License file not found. " "Either add a file named LICENSE, " "import upstream's COPYING if available, " "or add a 'License File:' line to README.chromium " "with the appropriate path.") return metadata
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Parse metadata fields out of README.chromium. # We examine "LICENSE" for the license file by default. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } if path in SPECIAL_CASES: metadata.update(SPECIAL_CASES[path]) else: # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") for line in open(readme_path): line = line.strip() if not line: break for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium or licences.py " "SPECIAL_CASES") # Check that the license file exists. for filename in (metadata["License File"], "COPYING"): license_path = os.path.join(path, filename) if os.path.exists(license_path): metadata["License File"] = license_path break license_path = None if not license_path: raise LicenseError("License file not found. " "Either add a file named LICENSE, " "import upstream's COPYING if available, " "or add a 'License File:' line to README.chromium " "with the appropriate path.") return metadata
475,997
def ScanThirdPartyDirs(third_party_dirs): """Scan a list of directories and report on any problems we find.""" errors = [] for path in sorted(third_party_dirs): try: metadata = ParseDir(path) except LicenseError, e: errors.append((path, e.args[0])) continue for path, error in sorted(errors): print path + ": " + error
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] if path in PRUNE_PATHS: dirs[:] = [] continue for skip in PRUNE_DIRS: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': for dir in dirs: dirpath = os.path.join(path, dir) if dirpath not in PRUNE_PATHS: third_party_dirs.append(dirpath) dirs[:] = [] continue return third_party_dirs def ScanThirdPartyDirs(): """Scan a list of directories and report on any problems we find.""" errors = [] for path in sorted(third_party_dirs): try: metadata = ParseDir(path) except LicenseError, e: errors.append((path, e.args[0])) continue for path, error in sorted(errors): print path + ": " + error
475,998
def ScanThirdPartyDirs(third_party_dirs): """Scan a list of directories and report on any problems we find.""" errors = [] for path in sorted(third_party_dirs): try: metadata = ParseDir(path) except LicenseError, e: errors.append((path, e.args[0])) continue for path, error in sorted(errors): print path + ": " + error
def ScanThirdPartyDirs(third_party_dirs): """Scan a list of directories and report on any problems we find.""" errors = [] for path in sorted(third_party_dirs): try: metadata = ParseDir(path) except LicenseError, e: errors.append((path, e.args[0])) continue for path, error in sorted(errors): print path + ": " + error
475,999