| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.sdk.internal.browserfixture; | 5 package org.chromium.sdk.internal.browserfixture; |
| 6 | 6 |
| 7 import static org.chromium.sdk.tests.internal.JsonBuilderUtil.convertToRealJson; | 7 import static org.chromium.sdk.tests.internal.JsonBuilderUtil.convertToRealJson; |
| 8 import static org.chromium.sdk.tests.internal.JsonBuilderUtil.jsonArray; | 8 import static org.chromium.sdk.tests.internal.JsonBuilderUtil.jsonArray; |
| 9 import static org.chromium.sdk.tests.internal.JsonBuilderUtil.jsonObject; | 9 import static org.chromium.sdk.tests.internal.JsonBuilderUtil.jsonObject; |
| 10 import static org.chromium.sdk.tests.internal.JsonBuilderUtil.jsonProperty; | 10 import static org.chromium.sdk.tests.internal.JsonBuilderUtil.jsonProperty; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 private final ScriptManager scriptManager = ScriptImplTestGate.create(contextF
ilter); | 182 private final ScriptManager scriptManager = ScriptImplTestGate.create(contextF
ilter); |
| 183 | 183 |
| 184 public FixtureChromeStub() { | 184 public FixtureChromeStub() { |
| 185 JSONObject body = getJsonObjectByRef(getScriptRef()); | 185 JSONObject body = getJsonObjectByRef(getScriptRef()); |
| 186 ScriptHandle scriptsNormalBody; | 186 ScriptHandle scriptsNormalBody; |
| 187 try { | 187 try { |
| 188 scriptsNormalBody = V8ProtocolParserAccess.get().parseScriptHandle(body); | 188 scriptsNormalBody = V8ProtocolParserAccess.get().parseScriptHandle(body); |
| 189 } catch (JsonProtocolParseException e) { | 189 } catch (JsonProtocolParseException e) { |
| 190 throw new RuntimeException(e); | 190 throw new RuntimeException(e); |
| 191 } | 191 } |
| 192 scriptManager.addScript(scriptsNormalBody, constructScriptRefsTyped()); | 192 ScriptImplTestGate.addScript(scriptManager, scriptsNormalBody, constructScri
ptRefsTyped()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 public static int getNumber3Ref() { | 195 public static int getNumber3Ref() { |
| 196 return 65; | 196 return 65; |
| 197 } | 197 } |
| 198 | 198 |
| 199 public static int getLongValueRef() { | 199 public static int getLongValueRef() { |
| 200 return 66; | 200 return 66; |
| 201 } | 201 } |
| 202 | 202 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 } | 598 } |
| 599 | 599 |
| 600 public void sendAfterCompile() { | 600 public void sendAfterCompile() { |
| 601 JSONObject scriptsObject = getJsonObjectByRef(getCompiledScriptRef()); | 601 JSONObject scriptsObject = getJsonObjectByRef(getCompiledScriptRef()); |
| 602 ScriptHandle scriptsNormalBody; | 602 ScriptHandle scriptsNormalBody; |
| 603 try { | 603 try { |
| 604 scriptsNormalBody = V8ProtocolParserAccess.get().parseScriptHandle(scripts
Object); | 604 scriptsNormalBody = V8ProtocolParserAccess.get().parseScriptHandle(scripts
Object); |
| 605 } catch (JsonProtocolParseException e) { | 605 } catch (JsonProtocolParseException e) { |
| 606 throw new RuntimeException(e); | 606 throw new RuntimeException(e); |
| 607 } | 607 } |
| 608 scriptManager.addScript(scriptsNormalBody, constructScriptRefsTyped()); | 608 ScriptImplTestGate.addScript(scriptManager, scriptsNormalBody, constructScri
ptRefsTyped()); |
| 609 | 609 |
| 610 JSONObject scriptObject = getJsonObjectByRef(getCompiledScriptRef()); | 610 JSONObject scriptObject = getJsonObjectByRef(getCompiledScriptRef()); |
| 611 scriptObject.remove("source"); | 611 scriptObject.remove("source"); |
| 612 | 612 |
| 613 JSONObject afterCompileObject = jsonObject( | 613 JSONObject afterCompileObject = jsonObject( |
| 614 jsonProperty("seq", nextSeq()), | 614 jsonProperty("seq", nextSeq()), |
| 615 jsonProperty("type", "event"), | 615 jsonProperty("type", "event"), |
| 616 jsonProperty("event", "afterCompile"), | 616 jsonProperty("event", "afterCompile"), |
| 617 jsonProperty("success", true), | 617 jsonProperty("success", true), |
| 618 jsonProperty("body", jsonObject(jsonProperty("script", scriptObject))), | 618 jsonProperty("body", jsonObject(jsonProperty("script", scriptObject))), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 646 } | 646 } |
| 647 | 647 |
| 648 @JsonParserRoot | 648 @JsonParserRoot |
| 649 public interface FixtureParser { | 649 public interface FixtureParser { |
| 650 | 650 |
| 651 @JsonParseMethod | 651 @JsonParseMethod |
| 652 Refs parseRefs(Object refs) throws JsonProtocolParseException; | 652 Refs parseRefs(Object refs) throws JsonProtocolParseException; |
| 653 | 653 |
| 654 } | 654 } |
| 655 } | 655 } |
| OLD | NEW |