| Index: chrome/renderer/mock_render_thread.cc
|
| diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc
|
| index 6844c44c6841e6f17587b29acc5def934ecc651c..c6fc5192aae160d05e167b620e5625a3f6c43d2e 100644
|
| --- a/chrome/renderer/mock_render_thread.cc
|
| +++ b/chrome/renderer/mock_render_thread.cc
|
| @@ -16,6 +16,7 @@
|
| #include "ipc/ipc_message_utils.h"
|
| #include "ipc/ipc_sync_message.h"
|
| #include "printing/print_job_constants.h"
|
| +#include "printing/page_range.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| MockRenderThread::MockRenderThread()
|
| @@ -252,8 +253,29 @@ void MockRenderThread::OnUpdatePrintSettings(
|
| }
|
|
|
| // Just return the default settings.
|
| - if (printer_.get())
|
| - printer_->UpdateSettings(document_cookie, params);
|
| + if (printer_.get()) {
|
| + ListValue* page_range_array;
|
| + printing::PageRanges new_ranges;
|
| + if (job_settings.GetList(printing::kSettingPageRange, &page_range_array)) {
|
| + for (size_t index = 0; index < page_range_array->GetSize(); ++index) {
|
| + DictionaryValue* dict;
|
| + if (!page_range_array->GetDictionary(index, &dict))
|
| + continue;
|
| + printing::PageRange range;
|
| + if (!dict->GetInteger(printing::kSettingPageRangeFrom, &range.from) ||
|
| + !dict->GetInteger(printing::kSettingPageRangeTo, &range.to)) {
|
| + continue;
|
| + }
|
| + // Page numbers are 1-based in the dictionary.
|
| + // Page numbers are 0-based for the printing context.
|
| + range.from--;
|
| + range.to--;
|
| + new_ranges.push_back(range);
|
| + }
|
| + }
|
| + std::vector<int> pages(printing::PageRange::GetPages(new_ranges));
|
| + printer_->UpdateSettings(document_cookie, params, pages);
|
| + }
|
| }
|
|
|
| void MockRenderThread::set_print_dialog_user_response(bool response) {
|
|
|