def test_EndToEnd(self): # Test that we don't crash. This also runs through frame_load_lens. tmp = tempfile.NamedTemporaryFile() with gzip.GzipFile(self._ROLLING_STONE) as f: trace = loading_trace.LoadingTrace.FromJsonDict(json.load(f)) frame_lens = frame_load_lens.FrameLoadLens(trace) graph = loading_model.ResourceGraph(trace=trace, frame_lens=frame_lens) visualization = model_graph.GraphVisualization(graph) visualization.OutputDot(tmp)
def get_network_dependency_graph(json_dict): trace = loading_trace.LoadingTrace.FromJsonDict(json_dict) content_lens = ( content_classification_lens.ContentClassificationLens.WithRulesFiles( trace, '', '')) frame_lens = frame_load_lens.FrameLoadLens(trace) activity = activity_lens.ActivityLens(trace) deps_lens = request_dependencies_lens.RequestDependencyLens(trace) graph_view = loading_graph_view.LoadingGraphView( trace, deps_lens, content_lens, frame_lens, activity) return graph_view
def _ProcessJsonTrace(json_dict): trace = loading_trace.LoadingTrace.FromJsonDict(json_dict) content_lens = ( content_classification_lens.ContentClassificationLens.WithRulesFiles( trace, OPTIONS.ad_rules, OPTIONS.tracking_rules)) frame_lens = frame_load_lens.FrameLoadLens(trace) activity = activity_lens.ActivityLens(trace) deps_lens = request_dependencies_lens.RequestDependencyLens(trace) graph_view = loading_graph_view.LoadingGraphView( trace, deps_lens, content_lens, frame_lens, activity) if OPTIONS.noads: graph_view.RemoveAds() return graph_view
def _ProcessRequests(filename): with open(filename) as f: trace = loading_trace.LoadingTrace.FromJsonDict(json.load(f)) content_lens = (content_classification_lens.ContentClassificationLens. WithRulesFiles(trace, OPTIONS.ad_rules, OPTIONS.tracking_rules)) frame_lens = frame_load_lens.FrameLoadLens(trace) activity = activity_lens.ActivityLens(trace) graph = loading_model.ResourceGraph(trace, content_lens, frame_lens, activity) if OPTIONS.noads: graph.Set(node_filter=graph.FilterAds) return graph