constants.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. export const CHILD_TO_PARENT_MESSAGE_NAME = "ASRouter:child-to-parent";
  2. export const PARENT_TO_CHILD_MESSAGE_NAME = "ASRouter:parent-to-child";
  3. export const FAKE_LOCAL_MESSAGES = [
  4. {id: "foo", template: "simple_snippet", content: {title: "Foo", body: "Foo123"}},
  5. {id: "foo1", template: "simple_snippet", bundled: 2, order: 1, content: {title: "Foo1", body: "Foo123-1"}},
  6. {id: "foo2", template: "simple_snippet", bundled: 2, order: 2, content: {title: "Foo2", body: "Foo123-2"}},
  7. {id: "bar", template: "fancy_template", content: {title: "Foo", body: "Foo123"}},
  8. {id: "baz", content: {title: "Foo", body: "Foo123"}},
  9. {id: "newsletter", template: "newsletter_snippet", content: {title: "Foo", body: "Foo123"}},
  10. {id: "fxa", template: "fxa_signup_snippet", content: {title: "Foo", body: "Foo123"}},
  11. {id: "belowsearch", template: "simple_below_search_snippet", content: {text: "Foo"}},
  12. ];
  13. export const FAKE_LOCAL_PROVIDER = {id: "onboarding", type: "local", localProvider: "FAKE_LOCAL_PROVIDER", enabled: true, cohort: 0};
  14. export const FAKE_LOCAL_PROVIDERS = {FAKE_LOCAL_PROVIDER: {getMessages: () => FAKE_LOCAL_MESSAGES}};
  15. export const FAKE_REMOTE_MESSAGES = [
  16. {id: "qux", template: "simple_snippet", content: {title: "Qux", body: "hello world"}},
  17. ];
  18. export const FAKE_REMOTE_PROVIDER = {id: "remotey", type: "remote", url: "http://fake.com/endpoint", enabled: true};
  19. export const FAKE_REMOTE_SETTINGS_PROVIDER = {id: "remotey-settingsy", type: "remote-settings", bucket: "bucketname", enabled: true};
  20. export const FAKE_RECOMMENDATION = {
  21. id: "fake_id",
  22. template: "cfr_doorhanger",
  23. content: {
  24. category: "cfrDummy",
  25. bucket_id: "fake_bucket_id",
  26. notification_text: "Fake Notification Text",
  27. info_icon: {
  28. label: "Fake Info Icon Label",
  29. sumo_path: "a_help_path_fragment",
  30. },
  31. heading_text: "Fake Heading Text",
  32. addon: {
  33. title: "Fake Addon Title",
  34. author: "Fake Addon Author",
  35. icon: "a_path_to_some_icon",
  36. rating: 4.2,
  37. users: 1234,
  38. amo_url: "a_path_to_amo",
  39. },
  40. descriptionDetails: {
  41. steps: [{string_id: "cfr-features-step1"}],
  42. },
  43. text: "Here is the recommendation text body",
  44. buttons: {
  45. primary: {
  46. label: {string_id: "primary_button_id"},
  47. action: {
  48. id: "primary_action",
  49. data: {},
  50. },
  51. },
  52. secondary: [{
  53. label: {string_id: "secondary_button_id"},
  54. action: {id: "secondary_action"},
  55. }, {
  56. label: {string_id: "secondary_button_id_2"},
  57. action: {id: "secondary_action"},
  58. }, {
  59. label: {string_id: "secondary_button_id_3"},
  60. action: {id: "secondary_action"},
  61. }],
  62. },
  63. },
  64. };
  65. // Stubs methods on RemotePageManager
  66. export class FakeRemotePageManager {
  67. constructor() {
  68. this.addMessageListener = sinon.stub();
  69. this.sendAsyncMessage = sinon.stub();
  70. this.removeMessageListener = sinon.stub();
  71. this.browser = {
  72. ownerGlobal: {
  73. openTrustedLinkIn: sinon.stub(),
  74. openLinkIn: sinon.stub(),
  75. OpenBrowserWindow: sinon.stub(),
  76. openPreferences: sinon.stub(),
  77. gBrowser: {
  78. pinTab: sinon.stub(),
  79. selectedTab: {},
  80. },
  81. ConfirmationHint: {
  82. show: sinon.stub(),
  83. },
  84. },
  85. };
  86. this.portID = "6000:2";
  87. }
  88. }