Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: components/printing/test/print_web_view_helper_browsertest.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "components/printing/renderer/print_web_view_helper.h"
6
5 #include <stddef.h> 7 #include <stddef.h>
6 8
9 #include <memory>
7 #include <tuple> 10 #include <tuple>
11 #include <utility>
8 12
9 #include "base/command_line.h" 13 #include "base/command_line.h"
10 #include "base/macros.h" 14 #include "base/macros.h"
11 #include "base/run_loop.h" 15 #include "base/run_loop.h"
12 #include "build/build_config.h" 16 #include "build/build_config.h"
13 #include "components/printing/common/print_messages.h" 17 #include "components/printing/common/print_messages.h"
14 #include "components/printing/renderer/print_web_view_helper.h"
15 #include "components/printing/test/mock_printer.h" 18 #include "components/printing/test/mock_printer.h"
16 #include "components/printing/test/print_mock_render_thread.h" 19 #include "components/printing/test/print_mock_render_thread.h"
17 #include "components/printing/test/print_test_content_renderer_client.h" 20 #include "components/printing/test/print_test_content_renderer_client.h"
18 #include "content/public/renderer/render_view.h" 21 #include "content/public/renderer/render_view.h"
19 #include "content/public/test/render_view_test.h" 22 #include "content/public/test/render_view_test.h"
20 #include "ipc/ipc_listener.h" 23 #include "ipc/ipc_listener.h"
21 #include "printing/print_job_constants.h" 24 #include "printing/print_job_constants.h"
22 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
23 #include "third_party/WebKit/public/platform/WebString.h" 26 #include "third_party/WebKit/public/platform/WebString.h"
24 #include "third_party/WebKit/public/web/WebLocalFrame.h" 27 #include "third_party/WebKit/public/web/WebLocalFrame.h"
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 TEST_F(MAYBE_PrintWebViewHelperPreviewTest, OnPrintPreviewForSelectedPages) { 865 TEST_F(MAYBE_PrintWebViewHelperPreviewTest, OnPrintPreviewForSelectedPages) {
863 LoadHTML(kMultipageHTML); 866 LoadHTML(kMultipageHTML);
864 867
865 // Fill in some dummy values. 868 // Fill in some dummy values.
866 base::DictionaryValue dict; 869 base::DictionaryValue dict;
867 CreatePrintSettingsDictionary(&dict); 870 CreatePrintSettingsDictionary(&dict);
868 871
869 // Set a page range and update the dictionary to generate only the complete 872 // Set a page range and update the dictionary to generate only the complete
870 // metafile with the selected pages. Page numbers used in the dictionary 873 // metafile with the selected pages. Page numbers used in the dictionary
871 // are 1-based. 874 // are 1-based.
872 base::DictionaryValue* page_range = new base::DictionaryValue(); 875 std::unique_ptr<base::DictionaryValue> page_range(
876 new base::DictionaryValue());
873 page_range->SetInteger(kSettingPageRangeFrom, 2); 877 page_range->SetInteger(kSettingPageRangeFrom, 2);
874 page_range->SetInteger(kSettingPageRangeTo, 3); 878 page_range->SetInteger(kSettingPageRangeTo, 3);
875 879
876 base::ListValue* page_range_array = new base::ListValue(); 880 base::ListValue* page_range_array = new base::ListValue();
877 page_range_array->Append(page_range); 881 page_range_array->Append(std::move(page_range));
878 882
879 dict.Set(kSettingPageRange, page_range_array); 883 dict.Set(kSettingPageRange, page_range_array);
880 dict.SetBoolean(kSettingGenerateDraftData, false); 884 dict.SetBoolean(kSettingGenerateDraftData, false);
881 885
882 OnPrintPreview(dict); 886 OnPrintPreview(dict);
883 887
884 VerifyDidPreviewPage(false, 0); 888 VerifyDidPreviewPage(false, 0);
885 VerifyDidPreviewPage(false, 1); 889 VerifyDidPreviewPage(false, 1);
886 VerifyDidPreviewPage(false, 2); 890 VerifyDidPreviewPage(false, 2);
887 VerifyPreviewPageCount(3); 891 VerifyPreviewPageCount(3);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 1055
1052 VerifyPrintFailed(true); 1056 VerifyPrintFailed(true);
1053 VerifyPagesPrinted(false); 1057 VerifyPagesPrinted(false);
1054 } 1058 }
1055 #endif // defined(ENABLE_BASIC_PRINTING) 1059 #endif // defined(ENABLE_BASIC_PRINTING)
1056 #endif // defined(ENABLE_PRINT_PREVIEW) 1060 #endif // defined(ENABLE_PRINT_PREVIEW)
1057 1061
1058 #endif // !defined(OS_CHROMEOS) 1062 #endif // !defined(OS_CHROMEOS)
1059 1063
1060 } // namespace printing 1064 } // namespace printing
OLDNEW
« no previous file with comments | « components/policy/core/common/schema_unittest.cc ('k') | components/search_engines/template_url_prepopulate_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698