Index: chrome/browser/resources/print_preview/native_layer.js |
diff --git a/chrome/browser/resources/print_preview/native_layer.js b/chrome/browser/resources/print_preview/native_layer.js |
index efdd55b36073695ca5a34c475a299e408e7ea0a9..633309f5668a1d99996cda86e161ddb2560b32d2 100644 |
--- a/chrome/browser/resources/print_preview/native_layer.js |
+++ b/chrome/browser/resources/print_preview/native_layer.js |
@@ -46,6 +46,8 @@ cr.define('print_preview', function() { |
global['onPrivetCapabilitiesSet'] = |
this.onPrivetCapabilitiesSet_.bind(this); |
global['onPrivetPrintFailed'] = this.onPrivetPrintFailed_.bind(this); |
+ global['onEnableManipulateSettingsForTest'] = |
+ this.onEnableManipulateSettingsForTest_.bind(this); |
Dan Beam
2014/06/20 02:45:16
all of these would be better as global.property in
ivandavid
2014/06/20 21:31:44
Done.
|
}; |
/** |
@@ -77,7 +79,9 @@ cr.define('print_preview', function() { |
PRIVET_PRINTER_CHANGED: 'print_preview.NativeLayer.PRIVET_PRINTER_CHANGED', |
PRIVET_CAPABILITIES_SET: |
'print_preview.NativeLayer.PRIVET_CAPABILITIES_SET', |
- PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED' |
+ PRIVET_PRINT_FAILED: 'print_preview.NativeLayer.PRIVET_PRINT_FAILED', |
+ MANIPULATE_SETTINGS_FOR_TEST: |
+ 'print_preview.NativeLayer.MANIPULATE_SETTINGS_FOR_TEST' |
Dan Beam
2014/06/20 02:45:16
alphabetize list
ivandavid
2014/06/20 21:31:44
Done.
|
}; |
/** |
@@ -672,6 +676,47 @@ cr.define('print_preview', function() { |
new Event(NativeLayer.EventType.PRIVET_PRINT_FAILED); |
privetPrintFailedEvent.httpError = http_error; |
this.dispatchEvent(privetPrintFailedEvent); |
+ }, |
+ |
+ /** |
+ * Function that allows for onManipulateSettings to be called |
+ * from the native layer. |
Dan Beam
2014/06/20 02:45:16
@private
ivandavid
2014/06/20 21:31:44
Done.
|
+ */ |
+ onEnableManipulateSettingsForTest_: function() { |
+ global['onManipulateSettingsForTest'] = |
+ this.onManipulateSettingsForTest_.bind(this); |
+ }, |
+ |
+ /** |
+ * Function that dispatches an event to print_preview.js to change |
+ * a particular setting for print preview. |
+ * @param {Dictionary} settings Dictionary containing the value to be |
Dan Beam
2014/06/20 02:45:16
s/Dictionary/Object/g
Aleksey Shlyapnikov
2014/06/20 17:27:22
!Object, since you do not handle settings to be nu
ivandavid
2014/06/20 21:31:44
Done.
|
+ * changed and that value should be set to. |
Dan Beam
2014/06/20 02:45:17
@private
ivandavid
2014/06/20 21:31:44
Done.
|
+ */ |
+ onManipulateSettingsForTest_: function(settings) { |
+ var manipulateSettingsEvent = |
+ new Event(NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST); |
+ manipulateSettingsEvent.settings = settings; |
+ this.dispatchEvent(manipulateSettingsEvent); |
+ }, |
+ |
+ /** |
+ * Function that sends a message to the test, letting it know that an |
+ * option has been set to a particular value and that the change has |
+ * finished modifying the preview area. |
+ */ |
+ previewReady: function() { |
Aleksey Shlyapnikov
2014/06/20 17:27:21
previewReadyForTest
ivandavid
2014/06/20 21:31:44
Done.
|
+ if (global['onManipulateSettingsForTest']) { |
Dan Beam
2014/06/20 02:45:17
no curlies for conditionals and conditional bodies
ivandavid
2014/06/20 21:31:44
Done.
ivandavid
2014/06/20 21:31:44
Done and applied this everywhere else where it hap
|
+ chrome.send('UILoadedForTest'); |
+ } |
+ }, |
+ |
+ /** |
+ * Function that notifies the test that the option it tried to change |
+ * had not been changed successfully. |
+ */ |
+ previewFailed: function() { |
Aleksey Shlyapnikov
2014/06/20 17:27:21
previewFailedForTest
ivandavid
2014/06/20 21:31:44
Done.
|
+ chrome.send('UIFailedLoadingForTest'); |
} |
}; |