Commit 50b80ef5 authored by Aleksey Kuznetsov's avatar Aleksey Kuznetsov Committed by Commit Bot

Settings import data dialog: send only checked checkboxes

During import process from C++ part we send
supported import options (checkboxes). In js
part we hide not supported checkboxes. But then
we send from js to C++ user choised checkboxes
includes hidden (that is true by default).
Need to exclude hidden checkboxes as unchecked.

Bug: 1107356
Change-Id: Idf372718c632217a5474e12b4117213f12c027e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2310532Reviewed-by: default avatardpapad <dpapad@chromium.org>
Commit-Queue: dpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791311}
parent 7e0a617a
...@@ -150,7 +150,7 @@ Polymer({ ...@@ -150,7 +150,7 @@ Polymer({
} else { } else {
const types = {}; const types = {};
checkboxes.forEach(checkbox => { checkboxes.forEach(checkbox => {
types[checkbox.pref.key] = checkbox.checked; types[checkbox.pref.key] = checkbox.checked && !checkbox.hidden;
}); });
this.browserProxy_.importData(this.$.browserSelect.selectedIndex, types); this.browserProxy_.importData(this.$.browserSelect.selectedIndex, types);
} }
......
...@@ -59,7 +59,7 @@ suite('ImportDataDialog', function() { ...@@ -59,7 +59,7 @@ suite('ImportDataDialog', function() {
{ {
autofillFormData: true, autofillFormData: true,
favorites: true, favorites: true,
history: true, history: false, // Emulate unsupported import option
index: 1, index: 1,
name: 'Mozilla Firefox', name: 'Mozilla Firefox',
passwords: true, passwords: true,
...@@ -233,6 +233,27 @@ suite('ImportDataDialog', function() { ...@@ -233,6 +233,27 @@ suite('ImportDataDialog', function() {
}); });
}); });
test('ImportFromBrowserProfileWithUnsupportedOption', function() {
// Flip all prefs to true.
Object.keys(prefs).forEach(function(prefName) {
ensureSettingsCheckboxCheckedStatus(prefName, true);
});
const expectedIndex = 1;
simulateBrowserProfileChange(expectedIndex);
dialog.$.import.click();
const importCalled = browserProxy.whenCalled('importData');
return importCalled.then(([actualIndex, types]) => {
assertEquals(expectedIndex, actualIndex);
Object.keys(prefs).forEach(function(prefName) {
// import_dialog_history is unsupported and hidden
assertEquals(prefName !== 'import_dialog_history', types[prefName]);
});
});
});
test('ImportError', function() { test('ImportError', function() {
simulateImportStatusChange(ImportDataStatus.FAILED); simulateImportStatusChange(ImportDataStatus.FAILED);
assertFalse(dialog.$.dialog.open); assertFalse(dialog.$.dialog.open);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment