diff --git a/tests/cefclient/browser/binding_test.cc b/tests/cefclient/browser/binding_test.cc index 792975cbb..61a260fce 100644 --- a/tests/cefclient/browser/binding_test.cc +++ b/tests/cefclient/browser/binding_test.cc @@ -9,8 +9,7 @@ #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace binding_test { +namespace client::binding_test { namespace { @@ -20,15 +19,15 @@ const char kTestMessageName[] = "BindingTest"; // Handle messages in the browser process. class Handler : public CefMessageRouterBrowserSide::Handler { public: - Handler() {} + Handler() = default; // Called due to cefQuery execution in binding.html. - virtual bool OnQuery(CefRefPtr browser, - CefRefPtr frame, - int64_t query_id, - const CefString& request, - bool persistent, - CefRefPtr callback) override { + bool OnQuery(CefRefPtr browser, + CefRefPtr frame, + int64_t query_id, + const CefString& request, + bool persistent, + CefRefPtr callback) override { // Only handle messages from the test URL. const std::string& url = frame->GetURL(); if (!test_runner::IsTestURL(url, kTestUrlPath)) { @@ -54,5 +53,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) { handlers.insert(new Handler()); } -} // namespace binding_test -} // namespace client +} // namespace client::binding_test diff --git a/tests/cefclient/browser/binding_test.h b/tests/cefclient/browser/binding_test.h index 969269454..c6cc2304b 100644 --- a/tests/cefclient/browser/binding_test.h +++ b/tests/cefclient/browser/binding_test.h @@ -8,13 +8,11 @@ #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace binding_test { +namespace client::binding_test { // Create message handlers. Called from test_runner.cc. void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers); -} // namespace binding_test -} // namespace client +} // namespace client::binding_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_BINDING_TEST_H_ diff --git a/tests/cefclient/browser/browser_window.cc b/tests/cefclient/browser/browser_window.cc index 355620c3a..68b29afc0 100644 --- a/tests/cefclient/browser/browser_window.cc +++ b/tests/cefclient/browser/browser_window.cc @@ -9,8 +9,7 @@ namespace client { -BrowserWindow::BrowserWindow(Delegate* delegate) - : delegate_(delegate), is_closing_(false) { +BrowserWindow::BrowserWindow(Delegate* delegate) : delegate_(delegate) { DCHECK(delegate_); } diff --git a/tests/cefclient/browser/browser_window.h b/tests/cefclient/browser/browser_window.h index 314ba1f36..5577f46a6 100644 --- a/tests/cefclient/browser/browser_window.h +++ b/tests/cefclient/browser/browser_window.h @@ -54,7 +54,7 @@ class BrowserWindow : public ClientHandler::Delegate { const std::vector& regions) = 0; protected: - virtual ~Delegate() {} + virtual ~Delegate() = default; }; // Create a new browser and native window. @@ -135,7 +135,7 @@ class BrowserWindow : public ClientHandler::Delegate { Delegate* delegate_; CefRefPtr browser_; CefRefPtr client_handler_; - bool is_closing_; + bool is_closing_ = false; private: DISALLOW_COPY_AND_ASSIGN(BrowserWindow); diff --git a/tests/cefclient/browser/browser_window_osr_win.cc b/tests/cefclient/browser/browser_window_osr_win.cc index 3a9e3c634..163af66da 100644 --- a/tests/cefclient/browser/browser_window_osr_win.cc +++ b/tests/cefclient/browser/browser_window_osr_win.cc @@ -12,7 +12,7 @@ BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate, bool with_controls, const std::string& startup_url, const OsrRendererSettings& settings) - : BrowserWindow(delegate), osr_hwnd_(nullptr), device_scale_factor_(0) { + : BrowserWindow(delegate) { osr_window_ = new OsrWindowWin(this, settings); client_handler_ = new ClientHandlerOsr(this, osr_window_.get(), with_controls, startup_url); diff --git a/tests/cefclient/browser/browser_window_osr_win.h b/tests/cefclient/browser/browser_window_osr_win.h index e8caf7183..627b0ca2e 100644 --- a/tests/cefclient/browser/browser_window_osr_win.h +++ b/tests/cefclient/browser/browser_window_osr_win.h @@ -56,9 +56,9 @@ class BrowserWindowOsrWin : public BrowserWindow, // The below members are only accessed on the main thread. scoped_refptr osr_window_; - HWND osr_hwnd_; + HWND osr_hwnd_ = nullptr; - float device_scale_factor_; + float device_scale_factor_ = 0; DISALLOW_COPY_AND_ASSIGN(BrowserWindowOsrWin); }; diff --git a/tests/cefclient/browser/bytes_write_handler.cc b/tests/cefclient/browser/bytes_write_handler.cc index d53b61aef..89668d0eb 100644 --- a/tests/cefclient/browser/bytes_write_handler.cc +++ b/tests/cefclient/browser/bytes_write_handler.cc @@ -12,7 +12,7 @@ namespace client { BytesWriteHandler::BytesWriteHandler(size_t grow) - : grow_(grow), datasize_(grow), offset_(0) { + : grow_(grow), datasize_(grow) { DCHECK_GT(grow, 0U); data_ = malloc(grow); DCHECK(data_ != nullptr); diff --git a/tests/cefclient/browser/bytes_write_handler.h b/tests/cefclient/browser/bytes_write_handler.h index b71d8fb94..2d9af4f13 100644 --- a/tests/cefclient/browser/bytes_write_handler.h +++ b/tests/cefclient/browser/bytes_write_handler.h @@ -14,7 +14,7 @@ namespace client { class BytesWriteHandler : public CefWriteHandler { public: explicit BytesWriteHandler(size_t grow); - ~BytesWriteHandler(); + ~BytesWriteHandler() override; size_t Write(const void* ptr, size_t size, size_t n) override; int Seek(int64_t offset, int whence) override; @@ -31,7 +31,7 @@ class BytesWriteHandler : public CefWriteHandler { size_t grow_; void* data_; int64_t datasize_; - int64_t offset_; + int64_t offset_ = 0; base::Lock lock_; diff --git a/tests/cefclient/browser/client_browser.cc b/tests/cefclient/browser/client_browser.cc index 1fbc6ad6d..c3b08f374 100644 --- a/tests/cefclient/browser/client_browser.cc +++ b/tests/cefclient/browser/client_browser.cc @@ -15,14 +15,13 @@ #include "tests/cefclient/browser/root_window_manager.h" #include "tests/shared/common/client_switches.h" -namespace client { -namespace browser { +namespace client::browser { namespace { class ClientBrowserDelegate : public ClientAppBrowser::Delegate { public: - ClientBrowserDelegate() {} + ClientBrowserDelegate() = default; void OnRegisterCustomPreferences( CefRefPtr app, @@ -75,10 +74,9 @@ class ClientBrowserDelegate : public ClientAppBrowser::Delegate { switches::kOffScreenRenderingEnabled, switches::kUseViews, }; - for (size_t i = 0; - i < sizeof(kIgnoredSwitches) / sizeof(kIgnoredSwitches[0]); ++i) { - if (command_line->HasSwitch(kIgnoredSwitches[i])) { - LOG(WARNING) << "The --" << kIgnoredSwitches[i] + for (auto& kIgnoredSwitche : kIgnoredSwitches) { + if (command_line->HasSwitch(kIgnoredSwitche)) { + LOG(WARNING) << "The --" << kIgnoredSwitche << " command-line switch is ignored on app relaunch."; } } @@ -112,5 +110,4 @@ void CreateDelegates(ClientAppBrowser::DelegateSet& delegates) { delegates.insert(new ClientBrowserDelegate); } -} // namespace browser -} // namespace client +} // namespace client::browser diff --git a/tests/cefclient/browser/client_browser.h b/tests/cefclient/browser/client_browser.h index ac09e422b..86fa62c57 100644 --- a/tests/cefclient/browser/client_browser.h +++ b/tests/cefclient/browser/client_browser.h @@ -9,13 +9,11 @@ #include "include/cef_base.h" #include "tests/shared/browser/client_app_browser.h" -namespace client { -namespace browser { +namespace client::browser { // Create the browser delegate. Called from client_app_delegates_browser.cc. void CreateDelegates(ClientAppBrowser::DelegateSet& delegates); -} // namespace browser -} // namespace client +} // namespace client::browser #endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_BROWSER_H_ diff --git a/tests/cefclient/browser/client_handler.cc b/tests/cefclient/browser/client_handler.cc index 3b742a4d5..e950e413a 100644 --- a/tests/cefclient/browser/client_handler.cc +++ b/tests/cefclient/browser/client_handler.cc @@ -353,8 +353,8 @@ bool IsAllowedAppMenuCommandId(int command_id) { IDC_OPTIONS, IDC_EXIT, }; - for (size_t i = 0; i < std::size(kAllowedCommandIds); ++i) { - if (command_id == kAllowedCommandIds[i]) { + for (int kAllowedCommandId : kAllowedCommandIds) { + if (command_id == kAllowedCommandId) { return true; } } @@ -397,8 +397,8 @@ bool IsAllowedContextMenuCommandId(int command_id) { IDC_CONTENT_CONTEXT_UNDO, IDC_CONTENT_CONTEXT_REDO, }; - for (size_t i = 0; i < std::size(kAllowedCommandIds); ++i) { - if (command_id == kAllowedCommandIds[i]) { + for (int kAllowedCommandId : kAllowedCommandIds) { + if (command_id == kAllowedCommandId) { return true; } } diff --git a/tests/cefclient/browser/client_handler.h b/tests/cefclient/browser/client_handler.h index f1f9fe1b9..3250ea99c 100644 --- a/tests/cefclient/browser/client_handler.h +++ b/tests/cefclient/browser/client_handler.h @@ -86,7 +86,7 @@ class ClientHandler : public CefClient, virtual void OnBeforeContextMenu(CefRefPtr model) {} protected: - virtual ~Delegate() {} + virtual ~Delegate() = default; }; typedef std::set MessageHandlerSet; @@ -439,9 +439,9 @@ class ClientHandler : public CefClient, // Track state information for the text context menu. struct TestMenuState { - TestMenuState() : check_item(true), radio_item(0) {} - bool check_item; - int radio_item; + TestMenuState() = default; + bool check_item = true; + int radio_item = 0; } test_menu_state_; // The current number of browsers using this handler. diff --git a/tests/cefclient/browser/client_handler_osr.h b/tests/cefclient/browser/client_handler_osr.h index 1fe247ea6..4ed713bb8 100644 --- a/tests/cefclient/browser/client_handler_osr.h +++ b/tests/cefclient/browser/client_handler_osr.h @@ -72,7 +72,7 @@ class ClientHandlerOsr : public ClientHandler, virtual void UpdateAccessibilityLocation(CefRefPtr value) = 0; protected: - virtual ~OsrDelegate() {} + virtual ~OsrDelegate() = default; }; ClientHandlerOsr(Delegate* delegate, diff --git a/tests/cefclient/browser/client_prefs.cc b/tests/cefclient/browser/client_prefs.cc index e64a1de67..0a07caeca 100644 --- a/tests/cefclient/browser/client_prefs.cc +++ b/tests/cefclient/browser/client_prefs.cc @@ -15,8 +15,7 @@ #include "tests/shared/common/client_switches.h" #include "tests/shared/common/string_util.h" -namespace client { -namespace prefs { +namespace client::prefs { namespace { @@ -41,18 +40,18 @@ static struct { std::optional ShowStateFromString(const std::string& str) { const auto strLower = AsciiStrToLower(str); - for (size_t i = 0; i < std::size(kWindowRestoreStateValueMap); ++i) { - if (strLower == kWindowRestoreStateValueMap[i].str) { - return kWindowRestoreStateValueMap[i].state; + for (auto i : kWindowRestoreStateValueMap) { + if (strLower == i.str) { + return i.state; } } return std::nullopt; } const char* ShowStateToString(cef_show_state_t show_state) { - for (size_t i = 0; i < std::size(kWindowRestoreStateValueMap); ++i) { - if (show_state == kWindowRestoreStateValueMap[i].state) { - return kWindowRestoreStateValueMap[i].str; + for (auto i : kWindowRestoreStateValueMap) { + if (show_state == i.state) { + return i.str; } } NOTREACHED(); @@ -202,5 +201,4 @@ bool SaveWindowRestorePreferences(cef_show_state_t show_state, error); } -} // namespace prefs -} // namespace client +} // namespace client::prefs diff --git a/tests/cefclient/browser/client_prefs.h b/tests/cefclient/browser/client_prefs.h index 577290d06..d2d4539e4 100644 --- a/tests/cefclient/browser/client_prefs.h +++ b/tests/cefclient/browser/client_prefs.h @@ -11,8 +11,7 @@ #include "include/cef_base.h" #include "include/cef_preference.h" -namespace client { -namespace prefs { +namespace client::prefs { // Register global preferences with default values. void RegisterGlobalPreferences(CefRawPtr registrar); @@ -23,7 +22,6 @@ bool LoadWindowRestorePreferences(cef_show_state_t& show_state, bool SaveWindowRestorePreferences(cef_show_state_t show_state, std::optional dip_bounds); -} // namespace prefs -} // namespace client +} // namespace client::prefs #endif // CEF_TESTS_CEFCLIENT_BROWSER_CLIENT_PREFS_H_ diff --git a/tests/cefclient/browser/dialog_test.cc b/tests/cefclient/browser/dialog_test.cc index 7fbc81479..2222e1633 100644 --- a/tests/cefclient/browser/dialog_test.cc +++ b/tests/cefclient/browser/dialog_test.cc @@ -11,8 +11,7 @@ #include "tests/cefclient/browser/test_runner.h" #include "tests/shared/browser/file_util.h" -namespace client { -namespace dialog_test { +namespace client::dialog_test { namespace { @@ -26,11 +25,11 @@ const char kFileSaveMessageName[] = "DialogTest.FileSave"; // Store persistent dialog state information. class DialogState : public base::RefCountedThreadSafe { public: - DialogState() : mode_(FILE_DIALOG_OPEN), pending_(false) {} + DialogState() = default; - cef_file_dialog_mode_t mode_; + cef_file_dialog_mode_t mode_ = FILE_DIALOG_OPEN; CefString last_file_; - bool pending_; + bool pending_ = false; DISALLOW_COPY_AND_ASSIGN(DialogState); }; @@ -43,7 +42,7 @@ class DialogCallback : public CefRunFileDialogCallback { scoped_refptr dialog_state) : router_callback_(router_callback), dialog_state_(dialog_state) {} - virtual void OnFileDialogDismissed( + void OnFileDialogDismissed( const std::vector& file_paths) override { CEF_REQUIRE_UI_THREAD(); DCHECK(dialog_state_->pending_); @@ -63,11 +62,11 @@ class DialogCallback : public CefRunFileDialogCallback { // Send a message back to the render process with the list of file paths. std::string response; - for (int i = 0; i < static_cast(file_paths.size()); ++i) { + for (const auto& file_path : file_paths) { if (!response.empty()) { response += "|"; // Use a delimiter disallowed in file paths. } - response += file_paths[i]; + response += file_path; } router_callback_->Success(response); @@ -88,15 +87,15 @@ class DialogCallback : public CefRunFileDialogCallback { // Handle messages in the browser process. class Handler : public CefMessageRouterBrowserSide::Handler { public: - Handler() {} + Handler() = default; // Called due to cefQuery execution in dialogs.html. - virtual bool OnQuery(CefRefPtr browser, - CefRefPtr frame, - int64_t query_id, - const CefString& request, - bool persistent, - CefRefPtr callback) override { + bool OnQuery(CefRefPtr browser, + CefRefPtr frame, + int64_t query_id, + const CefString& request, + bool persistent, + CefRefPtr callback) override { CEF_REQUIRE_UI_THREAD(); // Only handle messages from the test URL. @@ -174,5 +173,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) { handlers.insert(new Handler()); } -} // namespace dialog_test -} // namespace client +} // namespace client::dialog_test diff --git a/tests/cefclient/browser/dialog_test.h b/tests/cefclient/browser/dialog_test.h index 2044594f2..c0fd7068a 100644 --- a/tests/cefclient/browser/dialog_test.h +++ b/tests/cefclient/browser/dialog_test.h @@ -8,13 +8,11 @@ #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace dialog_test { +namespace client::dialog_test { // Create message handlers. Called from test_runner.cc. void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers); -} // namespace dialog_test -} // namespace client +} // namespace client::dialog_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_DIALOG_TEST_H_ diff --git a/tests/cefclient/browser/image_cache.cc b/tests/cefclient/browser/image_cache.cc index 216459386..b076a35ad 100644 --- a/tests/cefclient/browser/image_cache.cc +++ b/tests/cefclient/browser/image_cache.cc @@ -18,7 +18,7 @@ const char kEmptyId[] = "__empty"; } // namespace -ImageCache::ImageCache() {} +ImageCache::ImageCache() = default; ImageCache::~ImageCache() { CEF_REQUIRE_UI_THREAD(); @@ -54,7 +54,7 @@ ImageCache::ImageInfo ImageCache::ImageInfo::Create1x( const std::string& path_1x, bool internal) { ImageRepSet reps; - reps.push_back(ImageRep(path_1x, 1.0f)); + reps.emplace_back(path_1x, 1.0f); return ImageInfo(id, reps, internal, false); } @@ -65,8 +65,8 @@ ImageCache::ImageInfo ImageCache::ImageInfo::Create2x( const std::string& path_2x, bool internal) { ImageRepSet reps; - reps.push_back(ImageRep(path_1x, 1.0f)); - reps.push_back(ImageRep(path_2x, 2.0f)); + reps.emplace_back(path_1x, 1.0f); + reps.emplace_back(path_2x, 2.0f); return ImageInfo(id, reps, internal, false); } @@ -76,7 +76,7 @@ ImageCache::ImageInfo ImageCache::ImageInfo::Create2x(const std::string& id) { } struct ImageCache::ImageContent { - ImageContent() {} + ImageContent() = default; struct RepContent { RepContent(ImageType type, float scale_factor, const std::string& contents) @@ -217,8 +217,7 @@ bool ImageCache::LoadImageContents(const ImageInfo& info, << rep.path_; return false; } - content->contents_.push_back( - ImageContent::RepContent(rep_type, rep.scale_factor_, rep_contents)); + content->contents_.emplace_back(rep_type, rep.scale_factor_, rep_contents); } return true; diff --git a/tests/cefclient/browser/main_context_impl.cc b/tests/cefclient/browser/main_context_impl.cc index 819d22570..24365bdcf 100644 --- a/tests/cefclient/browser/main_context_impl.cc +++ b/tests/cefclient/browser/main_context_impl.cc @@ -5,6 +5,7 @@ #include "tests/cefclient/browser/main_context_impl.h" #include +#include #include "include/cef_parser.h" #include "tests/cefclient/browser/test_runner.h" @@ -288,8 +289,8 @@ bool MainContextImpl::Initialize(const CefMainArgs& args, // Need to create the RootWindowManager after calling CefInitialize because // TempWindowX11 uses cef_get_xdisplay(). - root_window_manager_.reset( - new RootWindowManager(terminate_when_all_windows_closed_)); + root_window_manager_ = + std::make_unique(terminate_when_all_windows_closed_); initialized_ = true; diff --git a/tests/cefclient/browser/main_context_impl.h b/tests/cefclient/browser/main_context_impl.h index 882cb91a0..6613cf6d9 100644 --- a/tests/cefclient/browser/main_context_impl.h +++ b/tests/cefclient/browser/main_context_impl.h @@ -55,7 +55,7 @@ class MainContextImpl : public MainContext { // Allow deletion via std::unique_ptr only. friend std::default_delete; - ~MainContextImpl(); + ~MainContextImpl() override; // Returns true if the context is in a valid state (initialized and not yet // shut down). diff --git a/tests/cefclient/browser/main_message_loop_multithreaded_win.cc b/tests/cefclient/browser/main_message_loop_multithreaded_win.cc index 349c1611a..6beba1a8f 100644 --- a/tests/cefclient/browser/main_message_loop_multithreaded_win.cc +++ b/tests/cefclient/browser/main_message_loop_multithreaded_win.cc @@ -21,9 +21,7 @@ const wchar_t kTaskMessageName[] = L"Client_CustomTask"; MainMessageLoopMultithreadedWin::MainMessageLoopMultithreadedWin() : thread_id_(base::PlatformThread::CurrentId()), - task_message_id_(RegisterWindowMessage(kTaskMessageName)), - dialog_hwnd_(nullptr), - message_hwnd_(nullptr) {} + task_message_id_(RegisterWindowMessage(kTaskMessageName)) {} MainMessageLoopMultithreadedWin::~MainMessageLoopMultithreadedWin() { DCHECK(RunsTasksOnCurrentThread()); @@ -118,8 +116,8 @@ HWND MainMessageLoopMultithreadedWin::CreateMessageWindow(HINSTANCE hInstance) { wc.lpszClassName = kWndClass; RegisterClassEx(&wc); - return CreateWindow(kWndClass, 0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInstance, - 0); + return CreateWindow(kWndClass, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, nullptr, + hInstance, nullptr); } // static diff --git a/tests/cefclient/browser/main_message_loop_multithreaded_win.h b/tests/cefclient/browser/main_message_loop_multithreaded_win.h index 61151060c..9cb95fcd2 100644 --- a/tests/cefclient/browser/main_message_loop_multithreaded_win.h +++ b/tests/cefclient/browser/main_message_loop_multithreaded_win.h @@ -22,7 +22,7 @@ namespace client { class MainMessageLoopMultithreadedWin : public MainMessageLoop { public: MainMessageLoopMultithreadedWin(); - ~MainMessageLoopMultithreadedWin(); + ~MainMessageLoopMultithreadedWin() override; // MainMessageLoop methods. int Run() override; @@ -47,12 +47,12 @@ class MainMessageLoopMultithreadedWin : public MainMessageLoop { UINT task_message_id_; // Only accessed on the main thread. - HWND dialog_hwnd_; + HWND dialog_hwnd_ = nullptr; base::Lock lock_; // Must be protected by |lock_|. - HWND message_hwnd_; + HWND message_hwnd_ = nullptr; std::queue> queued_tasks_; DISALLOW_COPY_AND_ASSIGN(MainMessageLoopMultithreadedWin); diff --git a/tests/cefclient/browser/media_router_test.cc b/tests/cefclient/browser/media_router_test.cc index 36cbe926e..c8d4d0494 100644 --- a/tests/cefclient/browser/media_router_test.cc +++ b/tests/cefclient/browser/media_router_test.cc @@ -12,8 +12,7 @@ #include "include/cef_parser.h" #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace media_router_test { +namespace client::media_router_test { namespace { @@ -93,10 +92,7 @@ class MediaObserver : public CefMediaObserver { MediaObserver(CefRefPtr media_router, CefRefPtr subscription_callback) : media_router_(media_router), - subscription_callback_(subscription_callback), - next_sink_query_id_(0), - pending_sink_query_id_(-1), - pending_sink_callbacks_(0U) {} + subscription_callback_(subscription_callback) {} ~MediaObserver() override { ClearSinkInfoMap(); } @@ -351,12 +347,12 @@ class MediaObserver : public CefMediaObserver { // Used to uniquely identify a call to OnSinks(), for the purpose of // associating OnMediaSinkDeviceInfo() callbacks. - int next_sink_query_id_; + int next_sink_query_id_ = 0; // State from the most recent call to OnSinks(). SinkInfoMap sink_info_map_; - int pending_sink_query_id_; - size_t pending_sink_callbacks_; + int pending_sink_query_id_ = -1; + size_t pending_sink_callbacks_ = 0U; // State from the most recent call to OnRoutes(). typedef std::map> RouteMap; @@ -373,7 +369,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler { Handler() { CEF_REQUIRE_UI_THREAD(); } - virtual ~Handler() { + ~Handler() override { SubscriptionStateMap::iterator it = subscription_state_map_.begin(); for (; it != subscription_state_map_.end(); ++it) { delete it->second; @@ -598,5 +594,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) { handlers.insert(new Handler()); } -} // namespace media_router_test -} // namespace client +} // namespace client::media_router_test diff --git a/tests/cefclient/browser/media_router_test.h b/tests/cefclient/browser/media_router_test.h index 1671ff02b..925b16aa8 100644 --- a/tests/cefclient/browser/media_router_test.h +++ b/tests/cefclient/browser/media_router_test.h @@ -8,13 +8,11 @@ #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace media_router_test { +namespace client::media_router_test { // Create message handlers. Called from test_runner.cc. void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers); -} // namespace media_router_test -} // namespace client +} // namespace client::media_router_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_MEDIA_ROUTER_TEST_H_ diff --git a/tests/cefclient/browser/osr_accessibility_helper.cc b/tests/cefclient/browser/osr_accessibility_helper.cc index caf3796d8..2b19fc326 100644 --- a/tests/cefclient/browser/osr_accessibility_helper.cc +++ b/tests/cefclient/browser/osr_accessibility_helper.cc @@ -7,7 +7,7 @@ namespace client { -OsrAXTree::OsrAXTree() : root_node_id_(-1) {} +OsrAXTree::OsrAXTree() = default; OsrAXNode* OsrAXTree::GetNode(int nodeId) const { auto result = node_map_.find(nodeId); @@ -38,7 +38,7 @@ void OsrAXTree::UpdateTreeData(CefRefPtr value) { OsrAccessibilityHelper::OsrAccessibilityHelper(CefRefPtr value, CefRefPtr browser) - : focused_node_id_(-1), browser_(browser) { + : browser_(browser) { UpdateAccessibilityTree(value); } diff --git a/tests/cefclient/browser/osr_accessibility_helper.h b/tests/cefclient/browser/osr_accessibility_helper.h index 83f271e41..802996473 100644 --- a/tests/cefclient/browser/osr_accessibility_helper.h +++ b/tests/cefclient/browser/osr_accessibility_helper.h @@ -27,7 +27,7 @@ class OsrAXTree { private: CefString parent_tree_id_; - int root_node_id_; + int root_node_id_ = -1; std::map node_map_; }; @@ -71,7 +71,7 @@ class OsrAccessibilityHelper { void DestroyNode(OsrAXNode* node); CefString root_tree_id_; CefString focused_tree_id_; - int focused_node_id_; + int focused_node_id_ = -1; CefRefPtr browser_; std::map accessibility_node_map_; }; diff --git a/tests/cefclient/browser/osr_accessibility_node.cc b/tests/cefclient/browser/osr_accessibility_node.cc index 648d50a93..83e3f1d17 100644 --- a/tests/cefclient/browser/osr_accessibility_node.cc +++ b/tests/cefclient/browser/osr_accessibility_node.cc @@ -17,9 +17,7 @@ OsrAXNode::OsrAXNode(const CefString& treeId, OsrAccessibilityHelper* helper) : tree_id_(treeId), node_id_(nodeId), - platform_accessibility_(nullptr), - parent_(nullptr), - offset_container_id_(-1), + accessibility_helper_(helper) { UpdateValue(value); } diff --git a/tests/cefclient/browser/osr_accessibility_node.h b/tests/cefclient/browser/osr_accessibility_node.h index ab8881915..5e40af1ac 100644 --- a/tests/cefclient/browser/osr_accessibility_node.h +++ b/tests/cefclient/browser/osr_accessibility_node.h @@ -111,9 +111,9 @@ class OsrAXNode { CefRect location_; CefPoint scroll_; std::vector child_ids_; - CefNativeAccessible* platform_accessibility_; - OsrAXNode* parent_; - int offset_container_id_; + CefNativeAccessible* platform_accessibility_ = nullptr; + OsrAXNode* parent_ = nullptr; + int offset_container_id_ = -1; OsrAccessibilityHelper* accessibility_helper_; CefRefPtr attributes_; }; diff --git a/tests/cefclient/browser/osr_accessibility_node_win.cc b/tests/cefclient/browser/osr_accessibility_node_win.cc index 5c5e64fb2..e784d88ef 100644 --- a/tests/cefclient/browser/osr_accessibility_node_win.cc +++ b/tests/cefclient/browser/osr_accessibility_node_win.cc @@ -247,17 +247,17 @@ struct CefIAccessible : public IAccessible { EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr) override; - CefIAccessible(OsrAXNode* node) : ref_count_(0), node_(node) {} + explicit CefIAccessible(OsrAXNode* node) : node_(node) {} // Remove the node reference when OsrAXNode is destroyed, so that // MSAA clients get CO_E_OBJNOTCONNECTED void MarkDestroyed() { node_ = nullptr; } protected: - virtual ~CefIAccessible() {} + virtual ~CefIAccessible() = default; // Ref Count - ULONG ref_count_; + ULONG ref_count_ = 0; // OsrAXNode* proxy object OsrAXNode* node_; }; diff --git a/tests/cefclient/browser/osr_d3d11_win.cc b/tests/cefclient/browser/osr_d3d11_win.cc index 14af7a9b8..0318c2fb1 100644 --- a/tests/cefclient/browser/osr_d3d11_win.cc +++ b/tests/cefclient/browser/osr_d3d11_win.cc @@ -28,8 +28,7 @@ #include "include/internal/cef_string.h" #include "tests/shared/browser/util_win.h" -namespace client { -namespace d3d11 { +namespace client::d3d11 { namespace { @@ -63,9 +62,7 @@ SwapChain::SwapChain(IDXGISwapChain* swapchain, : sampler_(to_com_ptr(sampler)), blender_(to_com_ptr(blender)), swapchain_(to_com_ptr(swapchain)), - rtv_(to_com_ptr(rtv)), - width_(0), - height_(0) {} + rtv_(to_com_ptr(rtv)) {} void SwapChain::bind(const std::shared_ptr& ctx) { ctx_ = ctx; @@ -113,7 +110,7 @@ void SwapChain::resize(int width, int height) { ID3D11DeviceContext* d3d11_ctx = (ID3D11DeviceContext*)(*ctx_); CHECK(d3d11_ctx); - d3d11_ctx->OMSetRenderTargets(0, 0, 0); + d3d11_ctx->OMSetRenderTargets(0, nullptr, nullptr); rtv_.reset(); DXGI_SWAP_CHAIN_DESC desc; @@ -505,16 +502,15 @@ std::shared_ptr Device::create_swapchain(HWND window, D3D11_BLEND_DESC desc; desc.AlphaToCoverageEnable = FALSE; desc.IndependentBlendEnable = FALSE; - const auto count = sizeof(desc.RenderTarget) / sizeof(desc.RenderTarget[0]); - for (size_t n = 0; n < count; ++n) { - desc.RenderTarget[n].BlendEnable = TRUE; - desc.RenderTarget[n].SrcBlend = D3D11_BLEND_ONE; - desc.RenderTarget[n].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; - desc.RenderTarget[n].SrcBlendAlpha = D3D11_BLEND_ONE; - desc.RenderTarget[n].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; - desc.RenderTarget[n].BlendOp = D3D11_BLEND_OP_ADD; - desc.RenderTarget[n].BlendOpAlpha = D3D11_BLEND_OP_ADD; - desc.RenderTarget[n].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + for (auto& n : desc.RenderTarget) { + n.BlendEnable = TRUE; + n.SrcBlend = D3D11_BLEND_ONE; + n.DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + n.SrcBlendAlpha = D3D11_BLEND_ONE; + n.DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; + n.BlendOp = D3D11_BLEND_OP_ADD; + n.BlendOpAlpha = D3D11_BLEND_OP_ADD; + n.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; } device_->CreateBlendState(&desc, &blender); } @@ -787,7 +783,7 @@ Layer::Layer(const std::shared_ptr& device, bool flip) bounds_.x = bounds_.y = bounds_.width = bounds_.height = 0.0f; } -Layer::~Layer() {} +Layer::~Layer() = default; void Layer::attach(const std::shared_ptr& parent) { composition_ = parent; @@ -842,7 +838,7 @@ void Layer::render_texture(const std::shared_ptr& ctx, Composition::Composition(const std::shared_ptr& device, int width, int height) - : width_(width), height_(height), vsync_(true), device_(device) { + : width_(width), height_(height), device_(device) { fps_ = 0.0; time_ = 0.0; frame_ = 0; @@ -932,5 +928,4 @@ void FrameBuffer::on_paint(void* shared_handle) { } } -} // namespace d3d11 -} // namespace client +} // namespace client::d3d11 diff --git a/tests/cefclient/browser/osr_d3d11_win.h b/tests/cefclient/browser/osr_d3d11_win.h index f1190e383..87f9701b5 100644 --- a/tests/cefclient/browser/osr_d3d11_win.h +++ b/tests/cefclient/browser/osr_d3d11_win.h @@ -26,8 +26,7 @@ #include "include/base/cef_macros.h" -namespace client { -namespace d3d11 { +namespace client::d3d11 { class Composition; class Context; @@ -68,11 +67,11 @@ class ScopedBinder { class Context { public: - Context(ID3D11DeviceContext*); + explicit Context(ID3D11DeviceContext*); void flush(); - operator ID3D11DeviceContext*() { return ctx_.get(); } + explicit operator ID3D11DeviceContext*() { return ctx_.get(); } private: const std::shared_ptr ctx_; @@ -87,7 +86,7 @@ class Device { std::string adapter_name() const; - operator ID3D11Device*() { return device_.get(); } + explicit operator ID3D11Device*() { return device_.get(); } std::shared_ptr immedidate_context(); @@ -157,8 +156,8 @@ class SwapChain { const std::shared_ptr swapchain_; std::shared_ptr rtv_; std::shared_ptr ctx_; - int width_; - int height_; + int width_ = 0; + int height_ = 0; DISALLOW_COPY_AND_ASSIGN(SwapChain); }; @@ -273,9 +272,9 @@ class Layer { // A collection of layers. Will render 1-N layers to a D3D11 device. class Composition : public std::enable_shared_from_this { public: - Composition(const std::shared_ptr& device, - int width = 0, - int height = 0); + explicit Composition(const std::shared_ptr& device, + int width = 0, + int height = 0); int width() const { return width_; } int height() const { return height_; } @@ -299,7 +298,7 @@ class Composition : public std::enable_shared_from_this { int64_t fps_start_; double fps_; double time_; - bool vsync_; + bool vsync_ = true; const std::shared_ptr device_; std::vector> layers_; @@ -324,7 +323,6 @@ class FrameBuffer { DISALLOW_COPY_AND_ASSIGN(FrameBuffer); }; -} // namespace d3d11 -} // namespace client +} // namespace client::d3d11 #endif // CEF_TESTS_CEFCLIENT_BROWSER_OSR_D3D11_WIN_H_ diff --git a/tests/cefclient/browser/osr_dragdrop_events.h b/tests/cefclient/browser/osr_dragdrop_events.h index db31e6bc5..4d1a4247a 100644 --- a/tests/cefclient/browser/osr_dragdrop_events.h +++ b/tests/cefclient/browser/osr_dragdrop_events.h @@ -29,7 +29,7 @@ class OsrDragEvents { CefBrowserHost::DragOperationsMask effect) = 0; protected: - virtual ~OsrDragEvents() {} + virtual ~OsrDragEvents() = default; }; } // namespace client diff --git a/tests/cefclient/browser/osr_dragdrop_win.cc b/tests/cefclient/browser/osr_dragdrop_win.cc index 512134fe5..23c15f7d9 100644 --- a/tests/cefclient/browser/osr_dragdrop_win.cc +++ b/tests/cefclient/browser/osr_dragdrop_win.cc @@ -342,7 +342,8 @@ CefRefPtr DataObjectToDragData(IDataObject* data_object) { if (format == CF_HDROP) { HDROP hdrop = (HDROP)hGlobal; const int kMaxFilenameLen = 4096; - const unsigned num_files = DragQueryFileW(hdrop, 0xffffffff, 0, 0); + const unsigned num_files = + DragQueryFileW(hdrop, 0xffffffff, nullptr, 0); for (unsigned int x = 0; x < num_files; ++x) { wchar_t filename[kMaxFilenameLen]; if (!DragQueryFileW(hdrop, x, filename, kMaxFilenameLen)) { @@ -475,7 +476,7 @@ HRESULT DragEnumFormatEtc::CreateEnumFormatEtc( UINT cfmt, FORMATETC* afmt, IEnumFORMATETC** ppEnumFormatEtc) { - if (cfmt == 0 || afmt == 0 || ppEnumFormatEtc == 0) { + if (cfmt == 0 || afmt == nullptr || ppEnumFormatEtc == nullptr) { return E_INVALIDARG; } @@ -497,7 +498,7 @@ HRESULT DragEnumFormatEtc::Next(ULONG celt, } // store result - if (pceltFetched != 0) { + if (pceltFetched != nullptr) { *pceltFetched = copied; } @@ -508,7 +509,7 @@ HRESULT DragEnumFormatEtc::Skip(ULONG celt) { m_nIndex += celt; return (m_nIndex <= m_nNumFormats) ? S_OK : S_FALSE; } -HRESULT DragEnumFormatEtc::Reset(void) { +HRESULT DragEnumFormatEtc::Reset() { m_nIndex = 0; return S_OK; } @@ -620,7 +621,7 @@ HRESULT DataObjectWin::GetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium) { // found a match - transfer data into supplied storage medium pMedium->tymed = m_pFormatEtc[idx].tymed; - pMedium->pUnkForRelease = 0; + pMedium->pUnkForRelease = nullptr; // copy the data into the caller's storage medium switch (m_pFormatEtc[idx].tymed) { diff --git a/tests/cefclient/browser/osr_dragdrop_win.h b/tests/cefclient/browser/osr_dragdrop_win.h index 29ef2605d..9bfbdb601 100644 --- a/tests/cefclient/browser/osr_dragdrop_win.h +++ b/tests/cefclient/browser/osr_dragdrop_win.h @@ -22,34 +22,34 @@ namespace client { -#define DEFAULT_QUERY_INTERFACE(__Class) \ - HRESULT __stdcall QueryInterface(const IID& iid, void** object) { \ - *object = nullptr; \ - if (IsEqualIID(iid, IID_IUnknown)) { \ - IUnknown* obj = this; \ - *object = obj; \ - } else if (IsEqualIID(iid, IID_##__Class)) { \ - __Class* obj = this; \ - *object = obj; \ - } else { \ - return E_NOINTERFACE; \ - } \ - AddRef(); \ - return S_OK; \ +#define DEFAULT_QUERY_INTERFACE(__Class) \ + HRESULT __stdcall QueryInterface(const IID& iid, void** object) override { \ + *object = nullptr; \ + if (IsEqualIID(iid, IID_IUnknown)) { \ + IUnknown* obj = this; \ + *object = obj; \ + } else if (IsEqualIID(iid, IID_##__Class)) { \ + __Class* obj = this; \ + *object = obj; \ + } else { \ + return E_NOINTERFACE; \ + } \ + AddRef(); \ + return S_OK; \ } -#define IUNKNOWN_IMPLEMENTATION \ - ULONG __stdcall AddRef() { \ - return ++ref_count_; \ - } \ - ULONG __stdcall Release() { \ - if (--ref_count_ == 0) { \ - delete this; \ - return 0U; \ - } \ - return ref_count_; \ - } \ - \ - protected: \ +#define IUNKNOWN_IMPLEMENTATION \ + ULONG __stdcall AddRef() override { \ + return ++ref_count_; \ + } \ + ULONG __stdcall Release() override { \ + if (--ref_count_ == 0) { \ + delete this; \ + return 0U; \ + } \ + return ref_count_; \ + } \ + \ + protected: \ ULONG ref_count_; class DropTargetWin : public IDropTarget { @@ -67,18 +67,18 @@ class DropTargetWin : public IDropTarget { HRESULT __stdcall DragEnter(IDataObject* data_object, DWORD key_state, POINTL cursor_position, - DWORD* effect); + DWORD* effect) override; HRESULT __stdcall DragOver(DWORD key_state, POINTL cursor_position, - DWORD* effect); + DWORD* effect) override; - HRESULT __stdcall DragLeave(); + HRESULT __stdcall DragLeave() override; HRESULT __stdcall Drop(IDataObject* data_object, DWORD key_state, POINTL cursor_position, - DWORD* effect); + DWORD* effect) override; DEFAULT_QUERY_INTERFACE(IDropTarget) IUNKNOWN_IMPLEMENTATION @@ -86,7 +86,7 @@ class DropTargetWin : public IDropTarget { protected: DropTargetWin(OsrDragEvents* callback, HWND hWnd) : ref_count_(0), callback_(callback), hWnd_(hWnd) {} - virtual ~DropTargetWin() {} + virtual ~DropTargetWin() = default; private: OsrDragEvents* callback_; @@ -100,16 +100,17 @@ class DropSourceWin : public IDropSource { static CComPtr Create(); // IDropSource implementation: - HRESULT __stdcall GiveFeedback(DWORD dwEffect); + HRESULT __stdcall GiveFeedback(DWORD dwEffect) override; - HRESULT __stdcall QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState); + HRESULT __stdcall QueryContinueDrag(BOOL fEscapePressed, + DWORD grfKeyState) override; DEFAULT_QUERY_INTERFACE(IDropSource) IUNKNOWN_IMPLEMENTATION protected: explicit DropSourceWin() : ref_count_(0) {} - virtual ~DropSourceWin() {} + virtual ~DropSourceWin() = default; }; class DragEnumFormatEtc : public IEnumFORMATETC { @@ -123,10 +124,10 @@ class DragEnumFormatEtc : public IEnumFORMATETC { // HRESULT __stdcall Next(ULONG celt, FORMATETC* pFormatEtc, - ULONG* pceltFetched); - HRESULT __stdcall Skip(ULONG celt); - HRESULT __stdcall Reset(void); - HRESULT __stdcall Clone(IEnumFORMATETC** ppEnumFormatEtc); + ULONG* pceltFetched) override; + HRESULT __stdcall Skip(ULONG celt) override; + HRESULT __stdcall Reset() override; + HRESULT __stdcall Clone(IEnumFORMATETC** ppEnumFormatEtc) override; // // Construction / Destruction @@ -152,23 +153,24 @@ class DataObjectWin : public IDataObject { int count); // IDataObject memberS - HRESULT __stdcall GetDataHere(FORMATETC* pFormatEtc, STGMEDIUM* pmedium); - HRESULT __stdcall QueryGetData(FORMATETC* pFormatEtc); + HRESULT __stdcall GetDataHere(FORMATETC* pFormatEtc, + STGMEDIUM* pmedium) override; + HRESULT __stdcall QueryGetData(FORMATETC* pFormatEtc) override; HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC* pFormatEct, - FORMATETC* pFormatEtcOut); + FORMATETC* pFormatEtcOut) override; HRESULT __stdcall SetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium, - BOOL fRelease); + BOOL fRelease) override; HRESULT __stdcall DAdvise(FORMATETC* pFormatEtc, DWORD advf, IAdviseSink*, - DWORD*); - HRESULT __stdcall DUnadvise(DWORD dwConnection); - HRESULT __stdcall EnumDAdvise(IEnumSTATDATA** ppEnumAdvise); + DWORD*) override; + HRESULT __stdcall DUnadvise(DWORD dwConnection) override; + HRESULT __stdcall EnumDAdvise(IEnumSTATDATA** ppEnumAdvise) override; HRESULT __stdcall EnumFormatEtc(DWORD dwDirection, - IEnumFORMATETC** ppEnumFormatEtc); - HRESULT __stdcall GetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium); + IEnumFORMATETC** ppEnumFormatEtc) override; + HRESULT __stdcall GetData(FORMATETC* pFormatEtc, STGMEDIUM* pMedium) override; DEFAULT_QUERY_INTERFACE(IDataObject) IUNKNOWN_IMPLEMENTATION @@ -183,7 +185,7 @@ class DataObjectWin : public IDataObject { int LookupFormatEtc(FORMATETC* pFormatEtc); explicit DataObjectWin(FORMATETC* fmtetc, STGMEDIUM* stgmed, int count); - virtual ~DataObjectWin() {} + virtual ~DataObjectWin() = default; }; } // namespace client diff --git a/tests/cefclient/browser/osr_ime_handler_win.cc b/tests/cefclient/browser/osr_ime_handler_win.cc index 115c2fe15..8b889c4fb 100644 --- a/tests/cefclient/browser/osr_ime_handler_win.cc +++ b/tests/cefclient/browser/osr_ime_handler_win.cc @@ -97,9 +97,8 @@ void GetCompositionUnderlines( } // namespace OsrImeHandlerWin::OsrImeHandlerWin(HWND hwnd) - : is_composing_(false), - input_language_id_(LANG_USER_DEFAULT), - system_caret_(false), + : input_language_id_(LANG_USER_DEFAULT), + cursor_index_(std::numeric_limits::max()), hwnd_(hwnd) { ime_rect_ = {-1, -1, 0, 0}; diff --git a/tests/cefclient/browser/osr_ime_handler_win.h b/tests/cefclient/browser/osr_ime_handler_win.h index de5b92fa8..ca2bf80b1 100644 --- a/tests/cefclient/browser/osr_ime_handler_win.h +++ b/tests/cefclient/browser/osr_ime_handler_win.h @@ -83,7 +83,7 @@ class OsrImeHandlerWin { bool GetString(HIMC imm_context, WPARAM lparam, int type, CefString& result); // Represents whether or not there is an ongoing composition. - bool is_composing_; + bool is_composing_ = false; // The current composition character range and its bounds. std::vector composition_bounds_; @@ -94,7 +94,7 @@ class OsrImeHandlerWin { // Represents whether or not the current input context has created a system // caret to set the position of its IME candidate window. - bool system_caret_; + bool system_caret_ = false; // The rectangle of the input caret retrieved from a renderer process. CefRect ime_rect_; diff --git a/tests/cefclient/browser/osr_render_handler_win.cc b/tests/cefclient/browser/osr_render_handler_win.cc index 525b7a253..a8b954af7 100644 --- a/tests/cefclient/browser/osr_render_handler_win.cc +++ b/tests/cefclient/browser/osr_render_handler_win.cc @@ -15,7 +15,7 @@ OsrRenderHandlerWin::OsrRenderHandlerWin(const OsrRendererSettings& settings, HWND hwnd) : settings_(settings), hwnd_(hwnd), - begin_frame_pending_(false), + weak_factory_(this) { CEF_REQUIRE_UI_THREAD(); DCHECK(hwnd_); diff --git a/tests/cefclient/browser/osr_render_handler_win.h b/tests/cefclient/browser/osr_render_handler_win.h index 4eee02496..b7031d572 100644 --- a/tests/cefclient/browser/osr_render_handler_win.h +++ b/tests/cefclient/browser/osr_render_handler_win.h @@ -68,7 +68,7 @@ class OsrRenderHandlerWin { // The below members are only accessed on the UI thread. const OsrRendererSettings settings_; const HWND hwnd_; - bool begin_frame_pending_; + bool begin_frame_pending_ = false; CefRefPtr browser_; // Must be the last member. diff --git a/tests/cefclient/browser/osr_render_handler_win_d3d11.cc b/tests/cefclient/browser/osr_render_handler_win_d3d11.cc index 93de15a5f..e85f4a699 100644 --- a/tests/cefclient/browser/osr_render_handler_win_d3d11.cc +++ b/tests/cefclient/browser/osr_render_handler_win_d3d11.cc @@ -80,7 +80,7 @@ void PopupLayer::set_bounds(const CefRect& bounds) { OsrRenderHandlerWinD3D11::OsrRenderHandlerWinD3D11( const OsrRendererSettings& settings, HWND hwnd) - : OsrRenderHandlerWin(settings, hwnd), start_time_(0) {} + : OsrRenderHandlerWin(settings, hwnd) {} bool OsrRenderHandlerWinD3D11::Initialize(CefRefPtr browser, int width, diff --git a/tests/cefclient/browser/osr_render_handler_win_d3d11.h b/tests/cefclient/browser/osr_render_handler_win_d3d11.h index cd0b8d503..ef1935cad 100644 --- a/tests/cefclient/browser/osr_render_handler_win_d3d11.h +++ b/tests/cefclient/browser/osr_render_handler_win_d3d11.h @@ -75,7 +75,7 @@ class OsrRenderHandlerWinD3D11 : public OsrRenderHandlerWin { private: void Render() override; - uint64_t start_time_; + uint64_t start_time_ = 0; std::shared_ptr device_; std::shared_ptr swap_chain_; std::shared_ptr composition_; diff --git a/tests/cefclient/browser/osr_render_handler_win_gl.cc b/tests/cefclient/browser/osr_render_handler_win_gl.cc index 506214b70..a376cb6d2 100644 --- a/tests/cefclient/browser/osr_render_handler_win_gl.cc +++ b/tests/cefclient/browser/osr_render_handler_win_gl.cc @@ -40,11 +40,7 @@ class ScopedGLContext { OsrRenderHandlerWinGL::OsrRenderHandlerWinGL( const OsrRendererSettings& settings, HWND hwnd) - : OsrRenderHandlerWin(settings, hwnd), - renderer_(settings), - hdc_(nullptr), - hrc_(nullptr), - painting_popup_(false) {} + : OsrRenderHandlerWin(settings, hwnd), renderer_(settings) {} void OsrRenderHandlerWinGL::Initialize(CefRefPtr browser) { CEF_REQUIRE_UI_THREAD(); diff --git a/tests/cefclient/browser/osr_render_handler_win_gl.h b/tests/cefclient/browser/osr_render_handler_win_gl.h index 88ff0920e..8f503012f 100644 --- a/tests/cefclient/browser/osr_render_handler_win_gl.h +++ b/tests/cefclient/browser/osr_render_handler_win_gl.h @@ -14,7 +14,7 @@ namespace client { class OsrRenderHandlerWinGL : public OsrRenderHandlerWin { public: OsrRenderHandlerWinGL(const OsrRendererSettings& settings, HWND hwnd); - virtual ~OsrRenderHandlerWinGL(); + ~OsrRenderHandlerWinGL() override; // Must be called immediately after object creation. void Initialize(CefRefPtr browser); @@ -45,9 +45,9 @@ class OsrRenderHandlerWinGL : public OsrRenderHandlerWin { // The below members are only accessed on the UI thread. OsrRenderer renderer_; - HDC hdc_; - HGLRC hrc_; - bool painting_popup_; + HDC hdc_ = nullptr; + HGLRC hrc_ = nullptr; + bool painting_popup_ = false; DISALLOW_COPY_AND_ASSIGN(OsrRenderHandlerWinGL); }; diff --git a/tests/cefclient/browser/osr_renderer_settings.h b/tests/cefclient/browser/osr_renderer_settings.h index cbd560bb4..4b5b94add 100644 --- a/tests/cefclient/browser/osr_renderer_settings.h +++ b/tests/cefclient/browser/osr_renderer_settings.h @@ -11,26 +11,21 @@ namespace client { struct OsrRendererSettings { - OsrRendererSettings() - : show_update_rect(false), - background_color(0), - shared_texture_enabled(false), - external_begin_frame_enabled(false), - begin_frame_rate(0) {} + OsrRendererSettings() = default; // If true draw a border around update rectangles. - bool show_update_rect; + bool show_update_rect = false; // Background color. Enables transparency if the alpha component is 0. - cef_color_t background_color; + cef_color_t background_color = 0; // Render using shared textures. Supported on Windows only via D3D11. - bool shared_texture_enabled; + bool shared_texture_enabled = false; // Client implements a BeginFrame timer by calling // CefBrowserHost::SendExternalBeginFrame at the specified frame rate. - bool external_begin_frame_enabled; - int begin_frame_rate; + bool external_begin_frame_enabled = false; + int begin_frame_rate = 0; }; } // namespace client diff --git a/tests/cefclient/browser/osr_window_win.cc b/tests/cefclient/browser/osr_window_win.cc index ed800525e..74cb22811 100644 --- a/tests/cefclient/browser/osr_window_win.cc +++ b/tests/cefclient/browser/osr_window_win.cc @@ -5,10 +5,13 @@ #include "tests/cefclient/browser/osr_window_win.h" #include + #if defined(CEF_USE_ATL) #include #endif +#include + #include "include/base/cef_build.h" #include "tests/cefclient/browser/main_context.h" #include "tests/cefclient/browser/osr_accessibility_helper.h" @@ -85,19 +88,9 @@ OsrWindowWin::OsrWindowWin(Delegate* delegate, const OsrRendererSettings& settings) : delegate_(delegate), settings_(settings), - hwnd_(nullptr), - device_scale_factor_(0), - hidden_(false), + last_mouse_pos_(), - current_mouse_pos_(), - mouse_rotation_(false), - mouse_tracking_(false), - last_click_x_(0), - last_click_y_(0), - last_click_button_(MBT_LEFT), - last_click_count_(1), - last_click_time_(0), - last_mouse_down_on_view_(false) { + current_mouse_pos_() { DCHECK(delegate_); client_rect_ = {0}; } @@ -299,10 +292,10 @@ void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) { // Create the native window with a border so it's easier to visually identify // OSR windows. hwnd_ = ::CreateWindowEx( - ex_style, kWndClass, 0, + ex_style, kWndClass, nullptr, WS_BORDER | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, - parent_hwnd, 0, hInst, 0); + parent_hwnd, nullptr, hInst, nullptr); CHECK(hwnd_); client_rect_ = rect; @@ -319,7 +312,7 @@ void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) { DCHECK_EQ(register_res, S_OK); #endif - ime_handler_.reset(new OsrImeHandlerWin(hwnd_)); + ime_handler_ = std::make_unique(hwnd_); // Enable Touch Events if requested if (client::MainContext::Get()->TouchEventsEnabled()) { @@ -1135,7 +1128,8 @@ void OsrWindowWin::UpdateAccessibilityTree(CefRefPtr value) { #if defined(CEF_USE_ATL) if (!accessibility_handler_) { - accessibility_handler_.reset(new OsrAccessibilityHelper(value, browser_)); + accessibility_handler_ = + std::make_unique(value, browser_); } else { accessibility_handler_->UpdateAccessibilityTree(value); } diff --git a/tests/cefclient/browser/osr_window_win.h b/tests/cefclient/browser/osr_window_win.h index fea8ec42e..971de657f 100644 --- a/tests/cefclient/browser/osr_window_win.h +++ b/tests/cefclient/browser/osr_window_win.h @@ -41,7 +41,7 @@ class OsrWindowWin virtual void OnOsrNativeWindowCreated(HWND hwnd) = 0; protected: - virtual ~Delegate() {} + virtual ~Delegate() = default; }; // |delegate| must outlive this object. @@ -72,7 +72,7 @@ class OsrWindowWin friend struct CefDeleteOnThread; friend class base::RefCountedThreadSafe; - ~OsrWindowWin(); + ~OsrWindowWin() override; // Manage native window lifespan. void Create(HWND parent_hwnd, const RECT& rect); @@ -172,14 +172,14 @@ class OsrWindowWin Delegate* delegate_; const OsrRendererSettings settings_; - HWND hwnd_; + HWND hwnd_ = nullptr; std::unique_ptr render_handler_; // Class that encapsulates IMM32 APIs and controls IMEs attached to a window. std::unique_ptr ime_handler_; RECT client_rect_; - float device_scale_factor_; + float device_scale_factor_ = 0; CefRefPtr browser_; @@ -193,19 +193,19 @@ class OsrWindowWin IAccessible* accessibility_root_; #endif - bool hidden_; + bool hidden_ = false; // Mouse state tracking. POINT last_mouse_pos_; POINT current_mouse_pos_; - bool mouse_rotation_; - bool mouse_tracking_; - int last_click_x_; - int last_click_y_; - CefBrowserHost::MouseButtonType last_click_button_; - int last_click_count_; - double last_click_time_; - bool last_mouse_down_on_view_; + bool mouse_rotation_ = false; + bool mouse_tracking_ = false; + int last_click_x_ = 0; + int last_click_y_ = 0; + CefBrowserHost::MouseButtonType last_click_button_ = MBT_LEFT; + int last_click_count_ = 1; + double last_click_time_ = 0; + bool last_mouse_down_on_view_ = false; DISALLOW_COPY_AND_ASSIGN(OsrWindowWin); }; diff --git a/tests/cefclient/browser/preferences_test.cc b/tests/cefclient/browser/preferences_test.cc index f3b69ba43..a2ca88bf9 100644 --- a/tests/cefclient/browser/preferences_test.cc +++ b/tests/cefclient/browser/preferences_test.cc @@ -13,8 +13,7 @@ #include "include/cef_parser.h" #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace preferences_test { +namespace client::preferences_test { namespace { @@ -263,8 +262,8 @@ class Handler : public CefMessageRouterBrowserSide::Handler { CefDictionaryValue::KeyList keys; dict->GetKeys(keys); - for (size_t i = 0; i < keys.size(); ++i) { - const std::string& key = keys[i]; + for (const auto& i : keys) { + const std::string& key = i; const std::string& current_name = name.empty() ? key : name + "." + key; if (!ApplyPrefs(context, current_name, dict->GetValue(key), error, changed_names)) { @@ -342,5 +341,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) { handlers.insert(new Handler()); } -} // namespace preferences_test -} // namespace client +} // namespace client::preferences_test diff --git a/tests/cefclient/browser/preferences_test.h b/tests/cefclient/browser/preferences_test.h index b11d89d2e..4041e93b3 100644 --- a/tests/cefclient/browser/preferences_test.h +++ b/tests/cefclient/browser/preferences_test.h @@ -8,13 +8,11 @@ #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace preferences_test { +namespace client::preferences_test { // Create message handlers. Called from test_runner.cc. void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers); -} // namespace preferences_test -} // namespace client +} // namespace client::preferences_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_PREFERENCES_TEST_H_ diff --git a/tests/cefclient/browser/resource_util_win_idmap.cc b/tests/cefclient/browser/resource_util_win_idmap.cc index 17bb8740a..1757e68de 100644 --- a/tests/cefclient/browser/resource_util_win_idmap.cc +++ b/tests/cefclient/browser/resource_util_win_idmap.cc @@ -49,9 +49,9 @@ int GetResourceId(const char* resource_name) { {"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML}, {"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML}}; - for (size_t i = 0; i < sizeof(resource_map) / sizeof(_resource_map); ++i) { - if (!strcmp(resource_map[i].name, resource_name)) { - return resource_map[i].id; + for (auto& i : resource_map) { + if (!strcmp(i.name, resource_name)) { + return i.id; } } diff --git a/tests/cefclient/browser/response_filter_test.cc b/tests/cefclient/browser/response_filter_test.cc index 4e2e2434a..dbc7017be 100644 --- a/tests/cefclient/browser/response_filter_test.cc +++ b/tests/cefclient/browser/response_filter_test.cc @@ -13,8 +13,7 @@ #include "tests/cefclient/browser/test_runner.h" #include "tests/shared/common/client_switches.h" -namespace client { -namespace response_filter_test { +namespace client::response_filter_test { namespace { @@ -31,10 +30,7 @@ const char kReplaceString[] = "This is the replaced string!"; // the logic in this implementation. class FindReplaceResponseFilter : public CefResponseFilter { public: - FindReplaceResponseFilter() - : find_match_offset_(0U), - replace_overflow_size_(0U), - replace_count_(0U) {} + FindReplaceResponseFilter() = default; bool InitFilter() override { const size_t find_size = sizeof(kFindString) - 1; @@ -158,16 +154,16 @@ class FindReplaceResponseFilter : public CefResponseFilter { } // The portion of the find string that is currently matching. - size_t find_match_offset_; + size_t find_match_offset_ = 0U; // The likely amount of overflow. - size_t replace_overflow_size_; + size_t replace_overflow_size_ = 0U; // Overflow from the output buffer. std::string overflow_; // Number of times the the string was found/replaced. - size_t replace_count_; + size_t replace_count_ = 0U; IMPLEMENT_REFCOUNTING(FindReplaceResponseFilter); }; @@ -175,7 +171,7 @@ class FindReplaceResponseFilter : public CefResponseFilter { // Filter that writes out all of the contents unchanged. class PassThruResponseFilter : public CefResponseFilter { public: - PassThruResponseFilter() {} + PassThruResponseFilter() = default; bool InitFilter() override { return true; } @@ -242,5 +238,4 @@ CefRefPtr GetResourceResponseFilter( return nullptr; } -} // namespace response_filter_test -} // namespace client +} // namespace client::response_filter_test diff --git a/tests/cefclient/browser/response_filter_test.h b/tests/cefclient/browser/response_filter_test.h index ddb232076..2524d4c68 100644 --- a/tests/cefclient/browser/response_filter_test.h +++ b/tests/cefclient/browser/response_filter_test.h @@ -11,8 +11,7 @@ #include "include/cef_response.h" #include "include/cef_response_filter.h" -namespace client { -namespace response_filter_test { +namespace client::response_filter_test { // Create a resource response filter. Called from test_runner.cc. CefRefPtr GetResourceResponseFilter( @@ -21,7 +20,6 @@ CefRefPtr GetResourceResponseFilter( CefRefPtr request, CefRefPtr response); -} // namespace response_filter_test -} // namespace client +} // namespace client::response_filter_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_RESPONSE_FILTER_TEST_H_ diff --git a/tests/cefclient/browser/root_window.cc b/tests/cefclient/browser/root_window.cc index b4e9efbe3..c5019acc1 100644 --- a/tests/cefclient/browser/root_window.cc +++ b/tests/cefclient/browser/root_window.cc @@ -17,9 +17,9 @@ RootWindowConfig::RootWindowConfig(CefRefPtr cmd) with_controls(!command_line->HasSwitch(switches::kHideControls)), url(MainContext::Get()->GetMainURL(command_line)) {} -RootWindow::RootWindow() : delegate_(nullptr) {} +RootWindow::RootWindow() = default; -RootWindow::~RootWindow() {} +RootWindow::~RootWindow() = default; // static scoped_refptr RootWindow::GetForBrowser(int browser_id) { diff --git a/tests/cefclient/browser/root_window.h b/tests/cefclient/browser/root_window.h index bce1d9d6b..0a72ad48b 100644 --- a/tests/cefclient/browser/root_window.h +++ b/tests/cefclient/browser/root_window.h @@ -39,7 +39,7 @@ struct RootWindowConfig { // |command_line| will be non-nullptr when used for new window creation via // OnAlreadyRunningAppRelaunch. Otherwise, the global command-line will be // used. - RootWindowConfig(CefRefPtr command_line = nullptr); + explicit RootWindowConfig(CefRefPtr command_line = nullptr); // Associated command-line. CefRefPtr command_line; @@ -129,7 +129,7 @@ class RootWindow bool with_osr) = 0; protected: - virtual ~Delegate() {} + virtual ~Delegate() = default; }; // Create a new RootWindow object. This method may be called on any thread. @@ -223,7 +223,7 @@ class RootWindow RootWindow(); virtual ~RootWindow(); - Delegate* delegate_; + Delegate* delegate_ = nullptr; }; } // namespace client diff --git a/tests/cefclient/browser/root_window_manager.cc b/tests/cefclient/browser/root_window_manager.cc index 732fe8bbb..520166a23 100644 --- a/tests/cefclient/browser/root_window_manager.cc +++ b/tests/cefclient/browser/root_window_manager.cc @@ -24,7 +24,7 @@ namespace { class ClientRequestContextHandler : public CefRequestContextHandler, public CefExtensionHandler { public: - ClientRequestContextHandler() {} + ClientRequestContextHandler() = default; // CefRequestContextHandler methods: void OnRequestContextInitialized( diff --git a/tests/cefclient/browser/root_window_manager.h b/tests/cefclient/browser/root_window_manager.h index 924d75e48..42559cd5e 100644 --- a/tests/cefclient/browser/root_window_manager.h +++ b/tests/cefclient/browser/root_window_manager.h @@ -88,7 +88,7 @@ class RootWindowManager : public RootWindow::Delegate { // Allow deletion via std::unique_ptr only. friend std::default_delete; - ~RootWindowManager(); + ~RootWindowManager() override; void OnRootWindowCreated(scoped_refptr root_window); void NotifyExtensionsChanged(); diff --git a/tests/cefclient/browser/root_window_views.cc b/tests/cefclient/browser/root_window_views.cc index 1245e878c..fad5690b7 100644 --- a/tests/cefclient/browser/root_window_views.cc +++ b/tests/cefclient/browser/root_window_views.cc @@ -543,8 +543,8 @@ void RootWindowViews::InitOnUIThread( // Populate the default image cache. ImageCache::ImageInfoSet image_set; - for (size_t i = 0U; i < std::size(kDefaultImageCache); ++i) { - image_set.push_back(ImageCache::ImageInfo::Create2x(kDefaultImageCache[i])); + for (auto& i : kDefaultImageCache) { + image_set.push_back(ImageCache::ImageInfo::Create2x(i)); } image_cache_->LoadImages( diff --git a/tests/cefclient/browser/root_window_views.h b/tests/cefclient/browser/root_window_views.h index da53ac1a3..6831fc921 100644 --- a/tests/cefclient/browser/root_window_views.h +++ b/tests/cefclient/browser/root_window_views.h @@ -26,7 +26,7 @@ class RootWindowViews : public RootWindow, // non-nullptr for popup browsers with a RootWindow parent (called on the UI // thread only). explicit RootWindowViews(RootWindowViews* parent_window); - ~RootWindowViews(); + ~RootWindowViews() override; void SetTitlebarHeight(const std::optional& height); diff --git a/tests/cefclient/browser/root_window_win.cc b/tests/cefclient/browser/root_window_win.cc index b4e910d7e..33e46f99b 100644 --- a/tests/cefclient/browser/root_window_win.cc +++ b/tests/cefclient/browser/root_window_win.cc @@ -6,6 +6,7 @@ #include +#include #include #include "include/base/cef_build.h" @@ -323,11 +324,11 @@ void RootWindowWin::CreateBrowserWindow(const std::string& startup_url) { if (with_osr_) { OsrRendererSettings settings = {}; MainContext::Get()->PopulateOsrSettings(&settings); - browser_window_.reset( - new BrowserWindowOsrWin(this, with_controls_, startup_url, settings)); + browser_window_ = std::make_unique( + this, with_controls_, startup_url, settings); } else { - browser_window_.reset( - new BrowserWindowStdWin(this, with_controls_, startup_url)); + browser_window_ = std::make_unique( + this, with_controls_, startup_url); } } @@ -944,38 +945,39 @@ void RootWindowWin::OnCreate(LPCREATESTRUCT lpCreateStruct) { back_hwnd_ = CreateWindow( L"BUTTON", L"Back", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED, x_offset, 0, button_width, urlbar_height, hwnd_, - reinterpret_cast(IDC_NAV_BACK), hInstance, 0); + reinterpret_cast(IDC_NAV_BACK), hInstance, nullptr); CHECK(back_hwnd_); x_offset += button_width; - forward_hwnd_ = - CreateWindow(L"BUTTON", L"Forward", - WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED, - x_offset, 0, button_width, urlbar_height, hwnd_, - reinterpret_cast(IDC_NAV_FORWARD), hInstance, 0); + forward_hwnd_ = CreateWindow( + L"BUTTON", L"Forward", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED, x_offset, 0, + button_width, urlbar_height, hwnd_, + reinterpret_cast(IDC_NAV_FORWARD), hInstance, nullptr); CHECK(forward_hwnd_); x_offset += button_width; - reload_hwnd_ = - CreateWindow(L"BUTTON", L"Reload", - WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED, - x_offset, 0, button_width, urlbar_height, hwnd_, - reinterpret_cast(IDC_NAV_RELOAD), hInstance, 0); + reload_hwnd_ = CreateWindow( + L"BUTTON", L"Reload", + WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED, x_offset, 0, + button_width, urlbar_height, hwnd_, + reinterpret_cast(IDC_NAV_RELOAD), hInstance, nullptr); CHECK(reload_hwnd_); x_offset += button_width; stop_hwnd_ = CreateWindow( L"BUTTON", L"Stop", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | WS_DISABLED, x_offset, 0, button_width, urlbar_height, hwnd_, - reinterpret_cast(IDC_NAV_STOP), hInstance, 0); + reinterpret_cast(IDC_NAV_STOP), hInstance, nullptr); CHECK(stop_hwnd_); x_offset += button_width; - edit_hwnd_ = CreateWindow(L"EDIT", 0, - WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | - ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_DISABLED, - x_offset, 0, rect.right - button_width * 4, - urlbar_height, hwnd_, 0, hInstance, 0); + edit_hwnd_ = + CreateWindow(L"EDIT", nullptr, + WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | + ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_DISABLED, + x_offset, 0, rect.right - button_width * 4, urlbar_height, + hwnd_, nullptr, hInstance, nullptr); CHECK(edit_hwnd_); // Override the edit control's window procedure. diff --git a/tests/cefclient/browser/root_window_win.h b/tests/cefclient/browser/root_window_win.h index f36b2cec8..7839b295d 100644 --- a/tests/cefclient/browser/root_window_win.h +++ b/tests/cefclient/browser/root_window_win.h @@ -25,7 +25,7 @@ class RootWindowWin : public RootWindow, public BrowserWindow::Delegate { public: // Constructor may be called on any thread. RootWindowWin(); - ~RootWindowWin(); + ~RootWindowWin() override; // RootWindow methods. void Init(RootWindow::Delegate* delegate, diff --git a/tests/cefclient/browser/scheme_test.cc b/tests/cefclient/browser/scheme_test.cc index 8233130b7..bc2cbdcde 100644 --- a/tests/cefclient/browser/scheme_test.cc +++ b/tests/cefclient/browser/scheme_test.cc @@ -18,15 +18,14 @@ #include "tests/cefclient/browser/test_runner.h" #include "tests/shared/browser/resource_util.h" -namespace client { -namespace scheme_test { +namespace client::scheme_test { namespace { // Implementation of the schema handler for client:// requests. class ClientSchemeHandler : public CefResourceHandler { public: - ClientSchemeHandler() : offset_(0) {} + ClientSchemeHandler() = default; bool Open(CefRefPtr request, bool& handle_request, @@ -119,7 +118,7 @@ class ClientSchemeHandler : public CefResourceHandler { private: std::string data_; std::string mime_type_; - size_t offset_; + size_t offset_ = 0; IMPLEMENT_REFCOUNTING(ClientSchemeHandler); DISALLOW_COPY_AND_ASSIGN(ClientSchemeHandler); @@ -128,7 +127,7 @@ class ClientSchemeHandler : public CefResourceHandler { // Implementation of the factory for for creating schema handlers. class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory { public: - ClientSchemeHandlerFactory() {} + ClientSchemeHandlerFactory() = default; // Return a new scheme handler instance to handle the request. CefRefPtr Create(CefRefPtr browser, @@ -150,5 +149,4 @@ void RegisterSchemeHandlers() { new ClientSchemeHandlerFactory()); } -} // namespace scheme_test -} // namespace client +} // namespace client::scheme_test diff --git a/tests/cefclient/browser/scheme_test.h b/tests/cefclient/browser/scheme_test.h index c48d6f6c8..da5f400e3 100644 --- a/tests/cefclient/browser/scheme_test.h +++ b/tests/cefclient/browser/scheme_test.h @@ -6,15 +6,13 @@ #define CEF_TESTS_CEFCLIENT_BROWSER_SCHEME_TEST_H_ #pragma once -namespace client { -namespace scheme_test { +namespace client::scheme_test { // Create and register the custom scheme handler. See // common/scheme_handler_common.h for registration of the custom scheme // name/type which must occur in all processes. Called from test_runner.cc. void RegisterSchemeHandlers(); -} // namespace scheme_test -} // namespace client +} // namespace client::scheme_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_SCHEME_TEST_H_ diff --git a/tests/cefclient/browser/server_test.cc b/tests/cefclient/browser/server_test.cc index 6101c3b35..d6670b8d7 100644 --- a/tests/cefclient/browser/server_test.cc +++ b/tests/cefclient/browser/server_test.cc @@ -15,8 +15,7 @@ #include "include/wrapper/cef_closure_task.h" #include "tests/shared/browser/resource_util.h" -namespace client { -namespace server_test { +namespace client::server_test { namespace { @@ -42,7 +41,7 @@ class ServerHandler : public CefServerHandler { public: using CompleteCallback = base::OnceCallback; - ServerHandler() {} + ServerHandler() = default; // |complete_callback| will be executed on the UI thread after completion. void StartServer(int port, CompleteCallback complete_callback) { @@ -213,7 +212,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler { public: Handler() : weak_ptr_factory_(this) {} - virtual ~Handler() { + ~Handler() override { if (handler_) { handler_->StopServer(ServerHandler::CompleteCallback()); handler_ = nullptr; @@ -221,12 +220,12 @@ class Handler : public CefMessageRouterBrowserSide::Handler { } // Called due to cefQuery execution in server.html. - virtual bool OnQuery(CefRefPtr browser, - CefRefPtr frame, - int64_t query_id, - const CefString& request, - bool persistent, - CefRefPtr callback) override { + bool OnQuery(CefRefPtr browser, + CefRefPtr frame, + int64_t query_id, + const CefString& request, + bool persistent, + CefRefPtr callback) override { CEF_REQUIRE_UI_THREAD(); // Only handle messages from the test URL. @@ -388,5 +387,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) { handlers.insert(new Handler()); } -} // namespace server_test -} // namespace client +} // namespace client::server_test diff --git a/tests/cefclient/browser/server_test.h b/tests/cefclient/browser/server_test.h index ffe3172ac..ed3b2dbbc 100644 --- a/tests/cefclient/browser/server_test.h +++ b/tests/cefclient/browser/server_test.h @@ -8,13 +8,11 @@ #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace server_test { +namespace client::server_test { // Create message handlers. Called from test_runner.cc. void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers); -} // namespace server_test -} // namespace client +} // namespace client::server_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_SERVER_TEST_H_ diff --git a/tests/cefclient/browser/temp_window_win.cc b/tests/cefclient/browser/temp_window_win.cc index 2bd74614c..aacb80eb6 100644 --- a/tests/cefclient/browser/temp_window_win.cc +++ b/tests/cefclient/browser/temp_window_win.cc @@ -26,8 +26,8 @@ HWND CreateTempWindow() { RegisterClassEx(&wc); // Create a 1x1 pixel hidden window. - return CreateWindow(kWndClass, 0, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, 0, 0, - 1, 1, nullptr, nullptr, hInstance, nullptr); + return CreateWindow(kWndClass, nullptr, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, + 0, 0, 1, 1, nullptr, nullptr, hInstance, nullptr); } TempWindowWin* g_temp_window = nullptr; diff --git a/tests/cefclient/browser/test_runner.cc b/tests/cefclient/browser/test_runner.cc index fe0becfbe..0b5611144 100644 --- a/tests/cefclient/browser/test_runner.cc +++ b/tests/cefclient/browser/test_runner.cc @@ -33,8 +33,7 @@ #include "tests/shared/browser/resource_util.h" #include "tests/shared/common/string_util.h" -namespace client { -namespace test_runner { +namespace client::test_runner { namespace { @@ -61,7 +60,7 @@ void RunGetSourceTest(CefRefPtr browser) { class Visitor : public CefStringVisitor { public: explicit Visitor(CefRefPtr browser) : browser_(browser) {} - virtual void Visit(const CefString& string) override { + void Visit(const CefString& string) override { std::string source = AsciiStrReplace(string, "<", "<"); source = AsciiStrReplace(source, ">", ">"); std::stringstream ss; @@ -82,7 +81,7 @@ void RunGetTextTest(CefRefPtr browser) { class Visitor : public CefStringVisitor { public: explicit Visitor(CefRefPtr browser) : browser_(browser) {} - virtual void Visit(const CefString& string) override { + void Visit(const CefString& string) override { std::string text = AsciiStrReplace(string, "<", "<"); text = AsciiStrReplace(text, ">", ">"); std::stringstream ss; @@ -168,15 +167,15 @@ const char kPromptDSF[] = "DSF"; // Handles execution of prompt results. class PromptHandler : public CefMessageRouterBrowserSide::Handler { public: - PromptHandler() {} + PromptHandler() = default; // Called due to cefQuery execution. - virtual bool OnQuery(CefRefPtr browser, - CefRefPtr frame, - int64_t query_id, - const CefString& request, - bool persistent, - CefRefPtr callback) override { + bool OnQuery(CefRefPtr browser, + CefRefPtr frame, + int64_t query_id, + const CefString& request, + bool persistent, + CefRefPtr callback) override { // Parse |request| which takes the form "Prompt.[type]:[value]". const std::string& request_str = request; if (request_str.find(kPrompt) != 0) { @@ -883,5 +882,4 @@ CefRefPtr GetResourceResponseFilter( request, response); } -} // namespace test_runner -} // namespace client +} // namespace client::test_runner diff --git a/tests/cefclient/browser/test_runner.h b/tests/cefclient/browser/test_runner.h index 5b6f01052..8de323b51 100644 --- a/tests/cefclient/browser/test_runner.h +++ b/tests/cefclient/browser/test_runner.h @@ -14,8 +14,7 @@ #include "include/wrapper/cef_message_router.h" #include "include/wrapper/cef_resource_manager.h" -namespace client { -namespace test_runner { +namespace client::test_runner { // Run a test. void RunTest(CefRefPtr browser, int id); @@ -66,7 +65,6 @@ CefRefPtr GetResourceResponseFilter( CefRefPtr request, CefRefPtr response); -} // namespace test_runner -} // namespace client +} // namespace client::test_runner #endif // CEF_TESTS_CEFCLIENT_BROWSER_TEST_RUNNER_H_ diff --git a/tests/cefclient/browser/urlrequest_test.cc b/tests/cefclient/browser/urlrequest_test.cc index 135d57b1d..e4d6ec914 100644 --- a/tests/cefclient/browser/urlrequest_test.cc +++ b/tests/cefclient/browser/urlrequest_test.cc @@ -13,8 +13,7 @@ #include "include/wrapper/cef_helpers.h" #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace urlrequest_test { +namespace client::urlrequest_test { namespace { @@ -86,7 +85,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler { public: Handler() { CEF_REQUIRE_UI_THREAD(); } - ~Handler() { CancelPendingRequest(); } + ~Handler() override { CancelPendingRequest(); } // Called due to cefQuery execution in urlrequest.html. bool OnQuery(CefRefPtr browser, @@ -184,5 +183,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) { handlers.insert(new Handler()); } -} // namespace urlrequest_test -} // namespace client +} // namespace client::urlrequest_test diff --git a/tests/cefclient/browser/urlrequest_test.h b/tests/cefclient/browser/urlrequest_test.h index ec572e716..b90797d5d 100644 --- a/tests/cefclient/browser/urlrequest_test.h +++ b/tests/cefclient/browser/urlrequest_test.h @@ -8,13 +8,11 @@ #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace urlrequest_test { +namespace client::urlrequest_test { // Create message handlers. Called from test_runner.cc. void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers); -} // namespace urlrequest_test -} // namespace client +} // namespace client::urlrequest_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_URLREQUEST_TEST_H_ diff --git a/tests/cefclient/browser/views_menu_bar.cc b/tests/cefclient/browser/views_menu_bar.cc index 6f04714e4..8567d688d 100644 --- a/tests/cefclient/browser/views_menu_bar.cc +++ b/tests/cefclient/browser/views_menu_bar.cc @@ -50,8 +50,7 @@ ViewsMenuBar::ViewsMenuBar(Delegate* delegate, : delegate_(delegate), id_start_(menu_id_start), use_bottom_controls_(use_bottom_controls), - id_next_(menu_id_start), - last_nav_with_keyboard_(false) { + id_next_(menu_id_start) { DCHECK(delegate_); DCHECK_GT(id_start_, 0); } diff --git a/tests/cefclient/browser/views_menu_bar.h b/tests/cefclient/browser/views_menu_bar.h index e1f6ec645..b11872985 100644 --- a/tests/cefclient/browser/views_menu_bar.h +++ b/tests/cefclient/browser/views_menu_bar.h @@ -32,7 +32,7 @@ class ViewsMenuBar : public CefMenuButtonDelegate, public CefMenuModelDelegate { cef_event_flags_t event_flags) = 0; protected: - virtual ~Delegate() {} + virtual ~Delegate() = default; }; // |delegate| must outlive this object. @@ -110,7 +110,7 @@ class ViewsMenuBar : public CefMenuButtonDelegate, public CefMenuModelDelegate { int id_next_; CefRefPtr panel_; std::vector> models_; - bool last_nav_with_keyboard_; + bool last_nav_with_keyboard_ = false; // Map of mnemonic to MenuButton ID. typedef std::map MnemonicMap; diff --git a/tests/cefclient/browser/views_overlay_controls.cc b/tests/cefclient/browser/views_overlay_controls.cc index 7fa294bcc..c946805ac 100644 --- a/tests/cefclient/browser/views_overlay_controls.cc +++ b/tests/cefclient/browser/views_overlay_controls.cc @@ -182,18 +182,18 @@ void ViewsOverlayControls::UpdateControls() { void ViewsOverlayControls::UpdateDraggableRegions( std::vector& window_regions) { if (panel_controller_ && panel_controller_->IsVisible()) { - window_regions.push_back(CefDraggableRegion(panel_controller_->GetBounds(), - /*draggable=*/false)); + window_regions.emplace_back(panel_controller_->GetBounds(), + /*draggable=*/false); } if (menu_controller_ && menu_controller_->IsVisible()) { - window_regions.push_back( - CefDraggableRegion(menu_controller_->GetBounds(), /*draggable=*/false)); + window_regions.emplace_back(menu_controller_->GetBounds(), + /*draggable=*/false); } if (location_controller_ && location_controller_->IsVisible()) { - window_regions.push_back(CefDraggableRegion( - location_controller_->GetBounds(), /*draggable=*/false)); + window_regions.emplace_back(location_controller_->GetBounds(), + /*draggable=*/false); } } diff --git a/tests/cefclient/browser/views_style.cc b/tests/cefclient/browser/views_style.cc index 4021ebd96..475cc9ed3 100644 --- a/tests/cefclient/browser/views_style.cc +++ b/tests/cefclient/browser/views_style.cc @@ -6,9 +6,7 @@ #include "tests/cefclient/browser/main_context.h" -namespace client { - -namespace views_style { +namespace client::views_style { namespace { @@ -113,6 +111,4 @@ void ApplyTo(CefRefPtr menu_model) { } } -} // namespace views_style - -} // namespace client +} // namespace client::views_style diff --git a/tests/cefclient/browser/views_style.h b/tests/cefclient/browser/views_style.h index f9b7c9702..bd4ecf0d0 100644 --- a/tests/cefclient/browser/views_style.h +++ b/tests/cefclient/browser/views_style.h @@ -11,9 +11,7 @@ #include "include/views/cef_panel.h" #include "include/views/cef_textfield.h" -namespace client { - -namespace views_style { +namespace client::views_style { // Returns true if a style is set. bool IsSet(); @@ -25,8 +23,6 @@ void ApplyTo(CefRefPtr label_button); void ApplyTo(CefRefPtr textfield); void ApplyTo(CefRefPtr menu_model); -} // namespace views_style - -} // namespace client +} // namespace client::views_style #endif // CEF_TESTS_CEFCLIENT_BROWSER_VIEWS_STYLE_H_ diff --git a/tests/cefclient/browser/views_window.cc b/tests/cefclient/browser/views_window.cc index 54e64a1d5..e6d2d7fbb 100644 --- a/tests/cefclient/browser/views_window.cc +++ b/tests/cefclient/browser/views_window.cc @@ -66,8 +66,8 @@ void MakeButtonsSameSize(const LabelButtons& buttons) { CefSize size; // Determine the largest button size. - for (size_t i = 0U; i < buttons.size(); ++i) { - const CefSize& button_size = buttons[i]->GetPreferredSize(); + for (const auto& button : buttons) { + const CefSize& button_size = button->GetPreferredSize(); if (size.width < button_size.width) { size.width = button_size.width; } @@ -76,12 +76,12 @@ void MakeButtonsSameSize(const LabelButtons& buttons) { } } - for (size_t i = 0U; i < buttons.size(); ++i) { + for (const auto& button : buttons) { // Set the button's minimum size. - buttons[i]->SetMinimumSize(size); + button->SetMinimumSize(size); // Re-layout the button and all parent Views. - buttons[i]->InvalidateLayout(); + button->InvalidateLayout(); } } @@ -1040,11 +1040,7 @@ ViewsWindow::ViewsWindow(WindowType type, Delegate* delegate, CefRefPtr browser_view, CefRefPtr command_line) - : type_(type), - delegate_(delegate), - command_line_(command_line), - menu_has_focus_(false), - last_focused_view_(false) { + : type_(type), delegate_(delegate), command_line_(command_line) { DCHECK(delegate_); if (browser_view) { @@ -1411,7 +1407,7 @@ void ViewsWindow::OnExtensionIconsLoaded(const ExtensionSet& extensions, if (!icon) { icon = delegate_->GetImageCache()->GetCachedImage(kDefaultExtensionIcon); } - extensions_.push_back(ExtensionInfo(*it1, icon)); + extensions_.emplace_back(*it1, icon); } UpdateExtensionControls(); diff --git a/tests/cefclient/browser/views_window.h b/tests/cefclient/browser/views_window.h index 2c0c999da..e6389df26 100644 --- a/tests/cefclient/browser/views_window.h +++ b/tests/cefclient/browser/views_window.h @@ -94,7 +94,7 @@ class ViewsWindow : public CefBrowserViewDelegate, virtual void OnExit() = 0; protected: - virtual ~Delegate() {} + virtual ~Delegate() = default; }; // Create a new top-level ViewsWindow hosting a browser with the specified @@ -272,8 +272,8 @@ class ViewsWindow : public CefBrowserViewDelegate, CefRefPtr toolbar_; CefRefPtr menu_button_; CefRefPtr location_bar_; - bool menu_has_focus_; - int last_focused_view_; + bool menu_has_focus_ = false; + int last_focused_view_ = false; std::optional last_visible_bounds_; CefSize minimum_window_size_; diff --git a/tests/cefclient/browser/window_test.cc b/tests/cefclient/browser/window_test.cc index 68c27fb68..2ee84597e 100644 --- a/tests/cefclient/browser/window_test.cc +++ b/tests/cefclient/browser/window_test.cc @@ -25,8 +25,7 @@ #include "tests/cefclient/browser/window_test_runner_mac.h" #endif -namespace client { -namespace window_test { +namespace client::window_test { namespace { @@ -86,12 +85,12 @@ class Handler : public CefMessageRouterBrowserSide::Handler { Handler() : runner_(CreateWindowTestRunner()) {} // Called due to cefBroadcast execution in window.html. - virtual bool OnQuery(CefRefPtr browser, - CefRefPtr frame, - int64_t query_id, - const CefString& request, - bool persistent, - CefRefPtr callback) override { + bool OnQuery(CefRefPtr browser, + CefRefPtr frame, + int64_t query_id, + const CefString& request, + bool persistent, + CefRefPtr callback) override { // Only handle messages from the test URL. const std::string& url = frame->GetURL(); if (!test_runner::IsTestURL(url, kTestUrlPath)) { @@ -133,5 +132,4 @@ void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers) { handlers.insert(new Handler()); } -} // namespace window_test -} // namespace client +} // namespace client::window_test diff --git a/tests/cefclient/browser/window_test.h b/tests/cefclient/browser/window_test.h index 2b99bbb86..2316001e4 100644 --- a/tests/cefclient/browser/window_test.h +++ b/tests/cefclient/browser/window_test.h @@ -8,13 +8,11 @@ #include "tests/cefclient/browser/test_runner.h" -namespace client { -namespace window_test { +namespace client::window_test { // Create message handlers. Called from test_runner.cc. void CreateMessageHandlers(test_runner::MessageHandlerSet& handlers); -} // namespace window_test -} // namespace client +} // namespace client::window_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_H_ diff --git a/tests/cefclient/browser/window_test_runner.cc b/tests/cefclient/browser/window_test_runner.cc index c81810b2b..137487334 100644 --- a/tests/cefclient/browser/window_test_runner.cc +++ b/tests/cefclient/browser/window_test_runner.cc @@ -4,8 +4,7 @@ #include "tests/cefclient/browser/window_test_runner.h" -namespace client { -namespace window_test { +namespace client::window_test { // static void WindowTestRunner::ModifyBounds(const CefRect& display, CefRect& window) { @@ -45,5 +44,4 @@ void WindowTestRunner::SetTitleBarHeight(CefRefPtr browser, NOTIMPLEMENTED(); } -} // namespace window_test -} // namespace client +} // namespace client::window_test diff --git a/tests/cefclient/browser/window_test_runner.h b/tests/cefclient/browser/window_test_runner.h index 8378d4ce9..7f98cda31 100644 --- a/tests/cefclient/browser/window_test_runner.h +++ b/tests/cefclient/browser/window_test_runner.h @@ -10,8 +10,7 @@ #include -namespace client { -namespace window_test { +namespace client::window_test { // Implement this interface for different platforms. Methods will be called on // the browser process UI thread unless otherwise indicated. @@ -37,7 +36,6 @@ class WindowTestRunner { const std::optional& height); }; -} // namespace window_test -} // namespace client +} // namespace client::window_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_H_ diff --git a/tests/cefclient/browser/window_test_runner_views.cc b/tests/cefclient/browser/window_test_runner_views.cc index 9508ca7cf..c3048b146 100644 --- a/tests/cefclient/browser/window_test_runner_views.cc +++ b/tests/cefclient/browser/window_test_runner_views.cc @@ -12,8 +12,7 @@ #include "tests/cefclient/browser/root_window_views.h" #include "tests/cefclient/browser/views_window.h" -namespace client { -namespace window_test { +namespace client::window_test { namespace { @@ -42,7 +41,7 @@ void SetTitlebarHeight(const CefRefPtr& browser, } // namespace -WindowTestRunnerViews::WindowTestRunnerViews() {} +WindowTestRunnerViews::WindowTestRunnerViews() = default; void WindowTestRunnerViews::SetPos(CefRefPtr browser, int x, @@ -86,5 +85,4 @@ void WindowTestRunnerViews::SetTitleBarHeight( SetTitlebarHeight(browser, height); } -} // namespace window_test -} // namespace client +} // namespace client::window_test diff --git a/tests/cefclient/browser/window_test_runner_views.h b/tests/cefclient/browser/window_test_runner_views.h index d8b0bde2a..cb075dc9f 100644 --- a/tests/cefclient/browser/window_test_runner_views.h +++ b/tests/cefclient/browser/window_test_runner_views.h @@ -8,8 +8,7 @@ #include "tests/cefclient/browser/window_test_runner.h" -namespace client { -namespace window_test { +namespace client::window_test { // Views platform implementation. class WindowTestRunnerViews : public WindowTestRunner { @@ -29,7 +28,6 @@ class WindowTestRunnerViews : public WindowTestRunner { const std::optional& height) override; }; -} // namespace window_test -} // namespace client +} // namespace client::window_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_VIEWS_H_ diff --git a/tests/cefclient/browser/window_test_runner_win.cc b/tests/cefclient/browser/window_test_runner_win.cc index d94e89802..ae40542f1 100644 --- a/tests/cefclient/browser/window_test_runner_win.cc +++ b/tests/cefclient/browser/window_test_runner_win.cc @@ -6,8 +6,7 @@ #include "tests/shared/browser/main_message_loop.h" -namespace client { -namespace window_test { +namespace client::window_test { namespace { @@ -99,7 +98,7 @@ void RestoreImpl(CefRefPtr browser) { } // namespace -WindowTestRunnerWin::WindowTestRunnerWin() {} +WindowTestRunnerWin::WindowTestRunnerWin() = default; void WindowTestRunnerWin::SetPos(CefRefPtr browser, int x, @@ -141,5 +140,4 @@ void WindowTestRunnerWin::Restore(CefRefPtr browser) { } } -} // namespace window_test -} // namespace client +} // namespace client::window_test diff --git a/tests/cefclient/browser/window_test_runner_win.h b/tests/cefclient/browser/window_test_runner_win.h index d6e38ef6d..1891c7a6e 100644 --- a/tests/cefclient/browser/window_test_runner_win.h +++ b/tests/cefclient/browser/window_test_runner_win.h @@ -8,8 +8,7 @@ #include "tests/cefclient/browser/window_test_runner.h" -namespace client { -namespace window_test { +namespace client::window_test { // Windows platform implementation. Methods are safe to call on any browser // process thread. @@ -27,7 +26,6 @@ class WindowTestRunnerWin : public WindowTestRunner { void Restore(CefRefPtr browser) override; }; -} // namespace window_test -} // namespace client +} // namespace client::window_test #endif // CEF_TESTS_CEFCLIENT_BROWSER_WINDOW_TEST_RUNNER_WIN_H_ diff --git a/tests/cefclient/cefclient_win.cc b/tests/cefclient/cefclient_win.cc index 305ee0695..68fef527f 100644 --- a/tests/cefclient/cefclient_win.cc +++ b/tests/cefclient/cefclient_win.cc @@ -88,11 +88,11 @@ int RunMain(HINSTANCE hInstance, int nCmdShow) { // Create the main message loop object. std::unique_ptr message_loop; if (settings.multi_threaded_message_loop) { - message_loop.reset(new MainMessageLoopMultithreadedWin); + message_loop = std::make_unique(); } else if (settings.external_message_pump) { message_loop = MainMessageLoopExternalPump::Create(); } else { - message_loop.reset(new MainMessageLoopStd); + message_loop = std::make_unique(); } // Initialize the CEF browser process. May return false if initialization diff --git a/tests/cefclient/common/scheme_test_common.cc b/tests/cefclient/common/scheme_test_common.cc index 7eb1eb66f..816cf7fa8 100644 --- a/tests/cefclient/common/scheme_test_common.cc +++ b/tests/cefclient/common/scheme_test_common.cc @@ -6,13 +6,11 @@ #include "include/cef_scheme.h" -namespace client { -namespace scheme_test { +namespace client::scheme_test { void RegisterCustomSchemes(CefRawPtr registrar) { registrar->AddCustomScheme( "client", CEF_SCHEME_OPTION_STANDARD | CEF_SCHEME_OPTION_CORS_ENABLED); } -} // namespace scheme_test -} // namespace client +} // namespace client::scheme_test diff --git a/tests/cefclient/common/scheme_test_common.h b/tests/cefclient/common/scheme_test_common.h index 7eb282150..600be781b 100644 --- a/tests/cefclient/common/scheme_test_common.h +++ b/tests/cefclient/common/scheme_test_common.h @@ -10,8 +10,7 @@ #include "include/cef_scheme.h" -namespace client { -namespace scheme_test { +namespace client::scheme_test { // Register the custom scheme name/type. This must be done in all processes. // See browser/scheme_test.h for creation/registration of the custom scheme @@ -19,7 +18,6 @@ namespace scheme_test { // client_app_delegates_common.cc. void RegisterCustomSchemes(CefRawPtr registrar); -} // namespace scheme_test -} // namespace client +} // namespace client::scheme_test #endif // CEF_TESTS_CEFCLIENT_COMMON_SCHEME_TEST_COMMON_H_ diff --git a/tests/cefclient/renderer/client_renderer.cc b/tests/cefclient/renderer/client_renderer.cc index 106a612ba..40862f8d7 100644 --- a/tests/cefclient/renderer/client_renderer.cc +++ b/tests/cefclient/renderer/client_renderer.cc @@ -12,8 +12,7 @@ #include "include/wrapper/cef_helpers.h" #include "include/wrapper/cef_message_router.h" -namespace client { -namespace renderer { +namespace client::renderer { namespace { @@ -22,7 +21,7 @@ const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged"; class ClientRenderDelegate : public ClientAppRenderer::Delegate { public: - ClientRenderDelegate() : last_node_is_editable_(false) {} + ClientRenderDelegate() = default; void OnWebKitInitialized(CefRefPtr app) override { if (CefCrashReportingEnabled()) { @@ -80,7 +79,7 @@ class ClientRenderDelegate : public ClientAppRenderer::Delegate { } private: - bool last_node_is_editable_; + bool last_node_is_editable_ = false; // Handles the renderer side of query routing. CefRefPtr message_router_; @@ -95,5 +94,4 @@ void CreateDelegates(ClientAppRenderer::DelegateSet& delegates) { delegates.insert(new ClientRenderDelegate); } -} // namespace renderer -} // namespace client +} // namespace client::renderer diff --git a/tests/cefclient/renderer/client_renderer.h b/tests/cefclient/renderer/client_renderer.h index 080764588..289635c9b 100644 --- a/tests/cefclient/renderer/client_renderer.h +++ b/tests/cefclient/renderer/client_renderer.h @@ -9,13 +9,11 @@ #include "include/cef_base.h" #include "tests/shared/renderer/client_app_renderer.h" -namespace client { -namespace renderer { +namespace client::renderer { // Create the renderer delegate. Called from client_app_delegates_renderer.cc. void CreateDelegates(ClientAppRenderer::DelegateSet& delegates); -} // namespace renderer -} // namespace client +} // namespace client::renderer #endif // CEF_TESTS_CEFCLIENT_RENDERER_CLIENT_RENDERER_H_ diff --git a/tests/cefclient/renderer/ipc_performance_test.cc b/tests/cefclient/renderer/ipc_performance_test.cc index c8b570a4b..492f8efaa 100644 --- a/tests/cefclient/renderer/ipc_performance_test.cc +++ b/tests/cefclient/renderer/ipc_performance_test.cc @@ -240,12 +240,10 @@ class IpcDelegate final : public client::ClientAppRenderer::Delegate { } // namespace -namespace client { -namespace ipc_performance_test { +namespace client::ipc_performance_test { void CreateDelegates(ClientAppRenderer::DelegateSet& delegates) { delegates.insert(new IpcDelegate()); } -} // namespace ipc_performance_test -} // namespace client +} // namespace client::ipc_performance_test diff --git a/tests/cefclient/renderer/ipc_performance_test.h b/tests/cefclient/renderer/ipc_performance_test.h index 1ba2727ec..a856a0b3b 100644 --- a/tests/cefclient/renderer/ipc_performance_test.h +++ b/tests/cefclient/renderer/ipc_performance_test.h @@ -8,12 +8,10 @@ #include "tests/shared/renderer/client_app_renderer.h" -namespace client { -namespace ipc_performance_test { +namespace client::ipc_performance_test { void CreateDelegates(ClientAppRenderer::DelegateSet& delegates); -} // namespace ipc_performance_test -} // namespace client +} // namespace client::ipc_performance_test #endif // CEF_TESTS_CEFCLIENT_RENDERER_IPC_PERFORMANCE_TEST_H_ diff --git a/tests/cefclient/renderer/performance_test.cc b/tests/cefclient/renderer/performance_test.cc index 8904191c4..16d318f47 100644 --- a/tests/cefclient/renderer/performance_test.cc +++ b/tests/cefclient/renderer/performance_test.cc @@ -11,8 +11,7 @@ #include "include/wrapper/cef_stream_resource_handler.h" #include "tests/cefclient/renderer/performance_test_setup.h" -namespace client { -namespace performance_test { +namespace client::performance_test { // Use more interations for a Release build. #if DCHECK_IS_ON() @@ -29,13 +28,13 @@ const char kPerfTestReturnValue[] = "PerfTestReturnValue"; class V8Handler : public CefV8Handler { public: - V8Handler() {} + V8Handler() = default; - virtual bool Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) override { + bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) override { if (name == kRunPerfTest) { if (arguments.size() == 1 && arguments[0]->IsString()) { // Run the specified perf test. @@ -126,12 +125,12 @@ class V8Handler : public CefV8Handler { // Handle bindings in the render process. class RenderDelegate : public ClientAppRenderer::Delegate { public: - RenderDelegate() {} + RenderDelegate() = default; - virtual void OnContextCreated(CefRefPtr app, - CefRefPtr browser, - CefRefPtr frame, - CefRefPtr context) override { + void OnContextCreated(CefRefPtr app, + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr context) override { CefRefPtr object = context->GetGlobal(); CefRefPtr handler = new V8Handler(); @@ -158,5 +157,4 @@ void CreateDelegates(ClientAppRenderer::DelegateSet& delegates) { delegates.insert(new RenderDelegate); } -} // namespace performance_test -} // namespace client +} // namespace client::performance_test diff --git a/tests/cefclient/renderer/performance_test.h b/tests/cefclient/renderer/performance_test.h index ce016bf12..ba53d4b8d 100644 --- a/tests/cefclient/renderer/performance_test.h +++ b/tests/cefclient/renderer/performance_test.h @@ -8,13 +8,11 @@ #include "tests/shared/renderer/client_app_renderer.h" -namespace client { -namespace performance_test { +namespace client::performance_test { // Create the renderer delegate. Called from client_app_delegates_renderer.cc. void CreateDelegates(ClientAppRenderer::DelegateSet& delegates); -} // namespace performance_test -} // namespace client +} // namespace client::performance_test #endif // CEF_TESTS_CEFCLIENT_RENDERER_PERFORMANCE_TEST_H_ diff --git a/tests/cefclient/renderer/performance_test_setup.h b/tests/cefclient/renderer/performance_test_setup.h index 5ed34b30b..df17cf9e5 100644 --- a/tests/cefclient/renderer/performance_test_setup.h +++ b/tests/cefclient/renderer/performance_test_setup.h @@ -9,8 +9,7 @@ #include "include/base/cef_logging.h" #include "include/base/cef_macros.h" -namespace client { -namespace performance_test { +namespace client::performance_test { // Default number of iterations. extern const int kDefaultIterations; @@ -35,7 +34,7 @@ typedef PERF_TEST_RESULT(PerfTest(PERF_TEST_PARAMS)); class CefTimer { public: - CefTimer() : running_(false) {} + CefTimer() = default; bool IsRunning() { return running_; } @@ -57,7 +56,7 @@ class CefTimer { } private: - bool running_; + bool running_ = false; CefTime start_; CefTime stop_; @@ -96,7 +95,6 @@ struct PerfTestEntry { extern const PerfTestEntry kPerfTests[]; extern const int kPerfTestsCount; -} // namespace performance_test -} // namespace client +} // namespace client::performance_test #endif // CEF_TESTS_CEFCLIENT_RENDERER_PERFORMANCE_TEST_H_ diff --git a/tests/cefclient/renderer/performance_test_tests.cc b/tests/cefclient/renderer/performance_test_tests.cc index b94df3620..633bc7311 100644 --- a/tests/cefclient/renderer/performance_test_tests.cc +++ b/tests/cefclient/renderer/performance_test_tests.cc @@ -6,8 +6,7 @@ #include "tests/cefclient/renderer/performance_test.h" #include "tests/cefclient/renderer/performance_test_setup.h" -namespace client { -namespace performance_test { +namespace client::performance_test { namespace { @@ -92,12 +91,12 @@ PERF_TEST_FUNC(V8ArrayGetValue) { PERF_TEST_FUNC(V8FunctionCreate) { class Handler : public CefV8Handler { public: - Handler() {} - virtual bool Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) override { + Handler() = default; + bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) override { return false; } IMPLEMENT_REFCOUNTING(Handler); @@ -114,12 +113,12 @@ PERF_TEST_FUNC(V8FunctionCreate) { PERF_TEST_FUNC(V8FunctionExecute) { class Handler : public CefV8Handler { public: - Handler() {} - virtual bool Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) override { + Handler() = default; + bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) override { return true; } IMPLEMENT_REFCOUNTING(Handler); @@ -139,12 +138,12 @@ PERF_TEST_FUNC(V8FunctionExecute) { PERF_TEST_FUNC(V8FunctionExecuteWithContext) { class Handler : public CefV8Handler { public: - Handler() {} - virtual bool Execute(const CefString& name, - CefRefPtr object, - const CefV8ValueList& arguments, - CefRefPtr& retval, - CefString& exception) override { + Handler() = default; + bool Execute(const CefString& name, + CefRefPtr object, + const CefV8ValueList& arguments, + CefRefPtr& retval, + CefString& exception) override { return true; } IMPLEMENT_REFCOUNTING(Handler); @@ -171,17 +170,17 @@ PERF_TEST_FUNC(V8ObjectCreate) { PERF_TEST_FUNC(V8ObjectCreateWithAccessor) { class Accessor : public CefV8Accessor { public: - Accessor() {} - virtual bool Get(const CefString& name, - const CefRefPtr object, - CefRefPtr& retval, - CefString& exception) override { + Accessor() = default; + bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { return true; } - virtual bool Set(const CefString& name, - const CefRefPtr object, - const CefRefPtr value, - CefString& exception) override { + bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { return true; } IMPLEMENT_REFCOUNTING(Accessor); @@ -197,29 +196,29 @@ PERF_TEST_FUNC(V8ObjectCreateWithAccessor) { PERF_TEST_FUNC(V8ObjectCreateWithInterceptor) { class Interceptor : public CefV8Interceptor { public: - Interceptor() {} - virtual bool Get(const CefString& name, - const CefRefPtr object, - CefRefPtr& retval, - CefString& exception) override { + Interceptor() = default; + bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { return true; } - virtual bool Get(int index, - const CefRefPtr object, - CefRefPtr& retval, - CefString& exception) override { + bool Get(int index, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { return true; } - virtual bool Set(const CefString& name, - const CefRefPtr object, - const CefRefPtr value, - CefString& exception) override { + bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { return true; } - virtual bool Set(int index, - const CefRefPtr object, - const CefRefPtr value, - CefString& exception) override { + bool Set(int index, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { return true; } IMPLEMENT_REFCOUNTING(Interceptor); @@ -257,17 +256,17 @@ PERF_TEST_FUNC(V8ObjectGetValue) { PERF_TEST_FUNC(V8ObjectSetValueWithAccessor) { class Accessor : public CefV8Accessor { public: - Accessor() {} - virtual bool Get(const CefString& name, - const CefRefPtr object, - CefRefPtr& retval, - CefString& exception) override { + Accessor() = default; + bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { return true; } - virtual bool Set(const CefString& name, - const CefRefPtr object, - const CefRefPtr value, - CefString& exception) override { + bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { val_ = value; return true; } @@ -292,17 +291,17 @@ PERF_TEST_FUNC(V8ObjectGetValueWithAccessor) { class Accessor : public CefV8Accessor { public: Accessor() : val_(CefV8Value::CreateBool(true)) {} - virtual bool Get(const CefString& name, - const CefRefPtr object, - CefRefPtr& retval, - CefString& exception) override { + bool Get(const CefString& name, + const CefRefPtr object, + CefRefPtr& retval, + CefString& exception) override { retval = val_; return true; } - virtual bool Set(const CefString& name, - const CefRefPtr object, - const CefRefPtr value, - CefString& exception) override { + bool Set(const CefString& name, + const CefRefPtr object, + const CefRefPtr value, + CefString& exception) override { return true; } CefRefPtr val_; @@ -392,5 +391,4 @@ const PerfTestEntry kPerfTests[] = { const int kPerfTestsCount = (sizeof(kPerfTests) / sizeof(kPerfTests[0])); -} // namespace performance_test -} // namespace client +} // namespace client::performance_test diff --git a/tests/cefsimple/simple_app.cc b/tests/cefsimple/simple_app.cc index 72556cf5a..a717e05d3 100644 --- a/tests/cefsimple/simple_app.cc +++ b/tests/cefsimple/simple_app.cc @@ -57,7 +57,7 @@ class SimpleWindowDelegate : public CefWindowDelegate { class SimpleBrowserViewDelegate : public CefBrowserViewDelegate { public: - SimpleBrowserViewDelegate() {} + SimpleBrowserViewDelegate() = default; bool OnPopupBrowserViewCreated(CefRefPtr browser_view, CefRefPtr popup_browser_view, @@ -78,7 +78,7 @@ class SimpleBrowserViewDelegate : public CefBrowserViewDelegate { } // namespace -SimpleApp::SimpleApp() {} +SimpleApp::SimpleApp() = default; void SimpleApp::OnContextInitialized() { CEF_REQUIRE_UI_THREAD(); diff --git a/tests/cefsimple/simple_handler.cc b/tests/cefsimple/simple_handler.cc index 0a36b3314..5179deb06 100644 --- a/tests/cefsimple/simple_handler.cc +++ b/tests/cefsimple/simple_handler.cc @@ -28,8 +28,7 @@ std::string GetDataURI(const std::string& data, const std::string& mime_type) { } // namespace -SimpleHandler::SimpleHandler(bool use_views) - : use_views_(use_views), is_closing_(false) { +SimpleHandler::SimpleHandler(bool use_views) : use_views_(use_views) { DCHECK(!g_instance); g_instance = this; } diff --git a/tests/cefsimple/simple_handler.h b/tests/cefsimple/simple_handler.h index c53421ec0..adeab0dcd 100644 --- a/tests/cefsimple/simple_handler.h +++ b/tests/cefsimple/simple_handler.h @@ -15,35 +15,31 @@ class SimpleHandler : public CefClient, public CefLoadHandler { public: explicit SimpleHandler(bool use_views); - ~SimpleHandler(); + ~SimpleHandler() override; // Provide access to the single global instance of this object. static SimpleHandler* GetInstance(); // CefClient methods: - virtual CefRefPtr GetDisplayHandler() override { - return this; - } - virtual CefRefPtr GetLifeSpanHandler() override { - return this; - } - virtual CefRefPtr GetLoadHandler() override { return this; } + CefRefPtr GetDisplayHandler() override { return this; } + CefRefPtr GetLifeSpanHandler() override { return this; } + CefRefPtr GetLoadHandler() override { return this; } // CefDisplayHandler methods: - virtual void OnTitleChange(CefRefPtr browser, - const CefString& title) override; + void OnTitleChange(CefRefPtr browser, + const CefString& title) override; // CefLifeSpanHandler methods: - virtual void OnAfterCreated(CefRefPtr browser) override; - virtual bool DoClose(CefRefPtr browser) override; - virtual void OnBeforeClose(CefRefPtr browser) override; + void OnAfterCreated(CefRefPtr browser) override; + bool DoClose(CefRefPtr browser) override; + void OnBeforeClose(CefRefPtr browser) override; // CefLoadHandler methods: - virtual void OnLoadError(CefRefPtr browser, - CefRefPtr frame, - ErrorCode errorCode, - const CefString& errorText, - const CefString& failedUrl) override; + void OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) override; // Request that all existing browser windows close. void CloseAllBrowsers(bool force_close); @@ -65,7 +61,7 @@ class SimpleHandler : public CefClient, typedef std::list> BrowserList; BrowserList browser_list_; - bool is_closing_; + bool is_closing_ = false; // Include the default reference counting implementation. IMPLEMENT_REFCOUNTING(SimpleHandler); diff --git a/tests/shared/browser/extension_util.cc b/tests/shared/browser/extension_util.cc index 088316e4e..3d7f17d0d 100644 --- a/tests/shared/browser/extension_util.cc +++ b/tests/shared/browser/extension_util.cc @@ -15,8 +15,7 @@ #include "tests/shared/browser/resource_util.h" #include "tests/shared/common/string_util.h" -namespace client { -namespace extension_util { +namespace client::extension_util { namespace { @@ -124,9 +123,9 @@ bool IsInternalExtension(const std::string& extension_path) { static const char* extensions[] = {"set_page_color"}; const std::string& internal_path = GetInternalPath(extension_path); - for (size_t i = 0; i < std::size(extensions); ++i) { + for (auto& i : extensions) { // Exact match or first directory component. - const std::string& extension = extensions[i]; + const std::string& extension = i; if (internal_path == extension || internal_path.find(extension + '/') == 0) { return true; @@ -253,5 +252,4 @@ std::string GetExtensionIconPath(CefRefPtr extension, return std::string(); } -} // namespace extension_util -} // namespace client +} // namespace client::extension_util diff --git a/tests/shared/browser/extension_util.h b/tests/shared/browser/extension_util.h index 10b3511bf..b7a6662bd 100644 --- a/tests/shared/browser/extension_util.h +++ b/tests/shared/browser/extension_util.h @@ -12,8 +12,7 @@ #include "include/cef_extension_handler.h" #include "include/wrapper/cef_resource_manager.h" -namespace client { -namespace extension_util { +namespace client::extension_util { // Returns true if |extension_path| can be handled internally via // LoadBinaryResource. This checks a hard-coded list of allowed extension path @@ -74,7 +73,6 @@ std::string GetExtensionURL(CefRefPtr extension); std::string GetExtensionIconPath(CefRefPtr extension, bool* internal); -} // namespace extension_util -} // namespace client +} // namespace client::extension_util #endif // CEF_TESTS_CEFCLIENT_BROWSER_EXTENSION_UTIL_H_ diff --git a/tests/shared/browser/file_util.cc b/tests/shared/browser/file_util.cc index d1ccaac6e..0bf3f935e 100644 --- a/tests/shared/browser/file_util.cc +++ b/tests/shared/browser/file_util.cc @@ -11,8 +11,7 @@ #include "include/base/cef_build.h" #include "include/cef_task.h" -namespace client { -namespace file_util { +namespace client::file_util { namespace { @@ -129,5 +128,4 @@ std::string GetFileExtension(const std::string& path) { return std::string(); } -} // namespace file_util -} // namespace client +} // namespace client::file_util diff --git a/tests/shared/browser/file_util.h b/tests/shared/browser/file_util.h index b08d7dc04..17c1055fd 100644 --- a/tests/shared/browser/file_util.h +++ b/tests/shared/browser/file_util.h @@ -9,8 +9,7 @@ #include #include -namespace client { -namespace file_util { +namespace client::file_util { // Platform-specific path separator. extern const char kPathSep; @@ -39,7 +38,6 @@ std::string JoinPath(const std::string& path1, const std::string& path2); // Extracts the file extension from |path|. std::string GetFileExtension(const std::string& path); -} // namespace file_util -} // namespace client +} // namespace client::file_util #endif // CEF_TESTS_SHARED_BROWSER_FILE_UTIL_H_ diff --git a/tests/shared/browser/main_message_loop_external_pump.cc b/tests/shared/browser/main_message_loop_external_pump.cc index fa16774a1..f15718640 100644 --- a/tests/shared/browser/main_message_loop_external_pump.cc +++ b/tests/shared/browser/main_message_loop_external_pump.cc @@ -26,8 +26,7 @@ client::MainMessageLoopExternalPump* g_external_message_pump = nullptr; } // namespace -MainMessageLoopExternalPump::MainMessageLoopExternalPump() - : is_active_(false), reentrancy_detected_(false) { +MainMessageLoopExternalPump::MainMessageLoopExternalPump() { DCHECK(!g_external_message_pump); g_external_message_pump = this; } diff --git a/tests/shared/browser/main_message_loop_external_pump.h b/tests/shared/browser/main_message_loop_external_pump.h index c64a5c427..5a618e552 100644 --- a/tests/shared/browser/main_message_loop_external_pump.h +++ b/tests/shared/browser/main_message_loop_external_pump.h @@ -40,7 +40,7 @@ class MainMessageLoopExternalPump : public MainMessageLoopStd { // Construct and destruct this object on the main application thread. MainMessageLoopExternalPump(); - ~MainMessageLoopExternalPump(); + ~MainMessageLoopExternalPump() override; // The platform subclass calls this method on the main application thread in // response to the OnScheduleMessagePumpWork() call. @@ -61,8 +61,8 @@ class MainMessageLoopExternalPump : public MainMessageLoopStd { void DoWork(); bool PerformMessageLoopWork(); - bool is_active_; - bool reentrancy_detected_; + bool is_active_ = false; + bool reentrancy_detected_ = false; }; } // namespace client diff --git a/tests/shared/browser/main_message_loop_external_pump_win.cc b/tests/shared/browser/main_message_loop_external_pump_win.cc index 9063ac746..e8c0546ef 100644 --- a/tests/shared/browser/main_message_loop_external_pump_win.cc +++ b/tests/shared/browser/main_message_loop_external_pump_win.cc @@ -22,7 +22,7 @@ static const int kMsgHaveWork = WM_USER + 1; class MainMessageLoopExternalPumpWin : public MainMessageLoopExternalPump { public: MainMessageLoopExternalPumpWin(); - ~MainMessageLoopExternalPumpWin(); + ~MainMessageLoopExternalPumpWin() override; // MainMessageLoopStd methods: void Quit() override; @@ -44,14 +44,13 @@ class MainMessageLoopExternalPumpWin : public MainMessageLoopExternalPump { LPARAM lparam); // True if a timer event is currently pending. - bool timer_pending_; + bool timer_pending_ = false; // HWND owned by the thread that CefDoMessageLoopWork should be invoked on. - HWND main_thread_target_; + HWND main_thread_target_ = nullptr; }; -MainMessageLoopExternalPumpWin::MainMessageLoopExternalPumpWin() - : timer_pending_(false), main_thread_target_(nullptr) { +MainMessageLoopExternalPumpWin::MainMessageLoopExternalPumpWin() { HINSTANCE hInstance = GetModuleHandle(nullptr); const wchar_t* const kClassName = L"CEFMainTargetHWND"; diff --git a/tests/shared/browser/main_message_loop_std.cc b/tests/shared/browser/main_message_loop_std.cc index d329f908e..ca156fea0 100644 --- a/tests/shared/browser/main_message_loop_std.cc +++ b/tests/shared/browser/main_message_loop_std.cc @@ -8,7 +8,7 @@ namespace client { -MainMessageLoopStd::MainMessageLoopStd() {} +MainMessageLoopStd::MainMessageLoopStd() = default; int MainMessageLoopStd::Run() { CefRunMessageLoop(); diff --git a/tests/shared/common/client_app.cc b/tests/shared/common/client_app.cc index 76ecde759..7d88a9d50 100644 --- a/tests/shared/common/client_app.cc +++ b/tests/shared/common/client_app.cc @@ -19,7 +19,7 @@ const char kZygoteProcess[] = "zygote"; } // namespace -ClientApp::ClientApp() {} +ClientApp::ClientApp() = default; // static ClientApp::ProcessType ClientApp::GetProcessType( diff --git a/tests/shared/common/client_app_other.cc b/tests/shared/common/client_app_other.cc index 9f6a0c4f4..e802caa8a 100644 --- a/tests/shared/common/client_app_other.cc +++ b/tests/shared/common/client_app_other.cc @@ -8,6 +8,6 @@ namespace client { -ClientAppOther::ClientAppOther() {} +ClientAppOther::ClientAppOther() = default; } // namespace client diff --git a/tests/shared/common/client_switches.cc b/tests/shared/common/client_switches.cc index 822a73833..5ac1be3ee 100644 --- a/tests/shared/common/client_switches.cc +++ b/tests/shared/common/client_switches.cc @@ -4,8 +4,7 @@ #include "tests/shared/common/client_switches.h" -namespace client { -namespace switches { +namespace client::switches { // CEF and Chromium support a wide range of command-line switches. This file // only contains command-line switches specific to the cefclient application. @@ -58,5 +57,4 @@ const char kUseBottomControls[] = "use-bottom-controls"; const char kHidePipFrame[] = "hide-pip-frame"; const char kHideChromeBubbles[] = "hide-chrome-bubbles"; -} // namespace switches -} // namespace client +} // namespace client::switches diff --git a/tests/shared/common/client_switches.h b/tests/shared/common/client_switches.h index 63e43e043..a2ac38b37 100644 --- a/tests/shared/common/client_switches.h +++ b/tests/shared/common/client_switches.h @@ -8,8 +8,7 @@ #define CEF_TESTS_SHARED_SHARED_COMMON_SWITCHES_H_ #pragma once -namespace client { -namespace switches { +namespace client::switches { extern const char kMultiThreadedMessageLoop[]; extern const char kExternalMessagePump[]; @@ -52,7 +51,6 @@ extern const char kUseBottomControls[]; extern const char kHidePipFrame[]; extern const char kHideChromeBubbles[]; -} // namespace switches -} // namespace client +} // namespace client::switches #endif // CEF_TESTS_SHARED_SHARED_COMMON_SWITCHES_H_