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

Side by Side Diff: LayoutTests/inspector/debugger/script-snippet-model.html

Issue 12622003: Merge 144463 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/WebCore/inspector/front-end/NavigatorView.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script> 4 <script src="../../http/tests/inspector/debugger-test.js"></script>
5 <script> 5 <script>
6 function test() 6 function test()
7 { 7 {
8 function resetSnippetsSettings() 8 function resetSnippetsSettings()
9 { 9 {
10 WebInspector.scriptSnippetModel._snippetStorage.reset(); 10 WebInspector.scriptSnippetModel._snippetStorage.reset();
11 WebInspector.scriptSnippetModel._lastSnippetEvaluationIndexSetting.set(0 ); 11 WebInspector.scriptSnippetModel._lastSnippetEvaluationIndexSetting.set(0 );
12 } 12 }
13 13
14 // FIXME: Remove once snippets are taken out of experiments. 14 // FIXME: Remove once snippets are taken out of experiments.
15 WebInspector.experimentsSettings.snippetsSupport = {}; 15 WebInspector.experimentsSettings.snippetsSupport = {};
16 WebInspector.experimentsSettings.snippetsSupport.isEnabled = function() { re turn true; }; 16 WebInspector.experimentsSettings.snippetsSupport.isEnabled = function() { re turn true; };
17 var workspace = new WebInspector.Workspace(); 17 var workspace = new WebInspector.Workspace();
18 var snippetWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(work space, WebInspector.projectTypes.Snippets); 18 var snippetWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(work space, WebInspector.projectTypes.Snippets);
19 var workspaceController = new WebInspector.WorkspaceController(workspace); 19 var workspaceController = new WebInspector.WorkspaceController(workspace);
20 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(worksp ace, snippetWorkspaceProvider); 20 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(worksp ace, snippetWorkspaceProvider);
21 InspectorTest.runDebuggerTestSuite([ 21 InspectorTest.runDebuggerTestSuite([
22 function testCreateAndRename(next) 22 function testCreateAndRename(next)
23 { 23 {
24 resetSnippetsSettings(); 24 resetSnippetsSettings();
25 var uiSourceCode = WebInspector.scriptSnippetModel.createScriptSnipp et(); 25 var uiSourceCode = WebInspector.scriptSnippetModel.createScriptSnipp et();
26 var snippetName = "TestSnippet" + Math.random(); 26 var snippetName = "TestSnippet" + Math.random();
27 InspectorTest.addResult("Snippet created."); 27 InspectorTest.addResult("Snippet created.");
28 WebInspector.scriptSnippetModel.renameScriptSnippet(uiSourceCode, sn ippetName); 28 WebInspector.scriptSnippetModel.renameScriptSnippet(uiSourceCode, sn ippetName);
29 uiSourceCode.rename(snippetName);
29 InspectorTest.assertEquals(1, workspace.uiSourceCodes().length, "Onl y one snippet uiSourceCode should be present."); 30 InspectorTest.assertEquals(1, workspace.uiSourceCodes().length, "Onl y one snippet uiSourceCode should be present.");
30 var uiSourceCode = workspace.uiSourceCodes()[0]; 31 var uiSourceCode = workspace.uiSourceCodes()[0];
31 if (uiSourceCode.originURL().indexOf(snippetName) === -1) 32 if (uiSourceCode.originURL().indexOf(snippetName) === -1)
32 return; 33 return;
33 InspectorTest.addResult("Snippet uiSourceCode url is correct."); 34 InspectorTest.addResult("Snippet uiSourceCode url is correct.");
34 next(); 35 next();
35 }, 36 },
36 37
37 function testEvaluate(next) 38 function testEvaluate(next)
38 { 39 {
39 resetSnippetsSettings(); 40 resetSnippetsSettings();
40 41
41 var uiSourceCode1 = WebInspector.scriptSnippetModel.createScriptSnip pet(); 42 var uiSourceCode1 = WebInspector.scriptSnippetModel.createScriptSnip pet();
42 WebInspector.scriptSnippetModel.renameScriptSnippet(uiSourceCode1, " Snippet1"); 43 WebInspector.scriptSnippetModel.renameScriptSnippet(uiSourceCode1, " Snippet1");
44 uiSourceCode1.rename("Snippet1");
43 var content = ""; 45 var content = "";
44 content += "// This snippet does nothing.\n"; 46 content += "// This snippet does nothing.\n";
45 content += "var i = 2+2;\n"; 47 content += "var i = 2+2;\n";
46 uiSourceCode1.setWorkingCopy(content); 48 uiSourceCode1.setWorkingCopy(content);
47 49
48 var uiSourceCode2 = WebInspector.scriptSnippetModel.createScriptSnip pet(); 50 var uiSourceCode2 = WebInspector.scriptSnippetModel.createScriptSnip pet();
49 WebInspector.scriptSnippetModel.renameScriptSnippet(uiSourceCode2, " Snippet2"); 51 WebInspector.scriptSnippetModel.renameScriptSnippet(uiSourceCode2, " Snippet2");
52 uiSourceCode2.rename("Snippet2");
50 content = ""; 53 content = "";
51 content += "// This snippet creates a function that does nothing and returns it.\n"; 54 content += "// This snippet creates a function that does nothing and returns it.\n";
52 content += "function doesNothing() {\n"; 55 content += "function doesNothing() {\n";
53 content += " var i = 2+2;\n"; 56 content += " var i = 2+2;\n";
54 content += "};\n"; 57 content += "};\n";
55 content += "doesNothing;\n"; 58 content += "doesNothing;\n";
56 uiSourceCode2.setWorkingCopy(content); 59 uiSourceCode2.setWorkingCopy(content);
57 60
58 function evaluateSnippetAndDumpEvaluationDetails(uiSourceCode, callb ack) 61 function evaluateSnippetAndDumpEvaluationDetails(uiSourceCode, callb ack)
59 { 62 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 95 }
93 } 96 }
94 ]); 97 ]);
95 }; 98 };
96 </script> 99 </script>
97 </head> 100 </head>
98 <body onload="runTest()"> 101 <body onload="runTest()">
99 <p>Tests script snippet model.</p> 102 <p>Tests script snippet model.</p>
100 </body> 103 </body>
101 </html> 104 </html>
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/inspector/front-end/NavigatorView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698