Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: installer/src/installer-lib/test/test-installer-lib-sandbox.cpp

Issue 29329159: Issue #1185 - Fix formatting in installer-lib and its tests (Closed)
Patch Set: Created Oct. 15, 2015, 7:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « installer/src/installer-lib/test/test-installer-lib-ca.rc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: installer/src/installer-lib/test/test-installer-lib-sandbox.cpp
===================================================================
--- a/installer/src/installer-lib/test/test-installer-lib-sandbox.cpp
+++ b/installer/src/installer-lib/test/test-installer-lib-sandbox.cpp
@@ -24,28 +24,28 @@
//-------------------------------------------------------
class log_single_window_handle
{
- ImmediateSession & session ;
+ ImmediateSession& session;
public:
- log_single_window_handle( ImmediateSession & session )
- : session( session )
+ log_single_window_handle(ImmediateSession& session)
+ : session(session)
{
}
- bool operator()( HWND window )
+ bool operator()(HWND window)
{
- std::stringstream s ;
- s << "Window handle 0x" << std::hex << window ;
- session.Log( s.str() ) ;
- return true ;
+ std::stringstream s;
+ s << "Window handle 0x" << std::hex << window;
+ session.Log(s.str());
+ return true;
}
-} ;
+};
-void log_all_window_handles( ImmediateSession & session )
+void log_all_window_handles(ImmediateSession& session)
{
- session.Log( "log_all_window_handles" ) ;
- log_single_window_handle lp( session ) ;
- EnumerateWindows( lp ) ;
+ session.Log("log_all_window_handles");
+ log_single_window_handle lp(session);
+ EnumerateWindows(lp);
}
//-------------------------------------------------------
@@ -53,88 +53,87 @@
//-------------------------------------------------------
class log_single_window_handle_only_if_IE
{
- ImmediateSession & session ;
+ ImmediateSession& session;
- ProcessCloser & pc ;
+ ProcessCloser& pc;
public:
- log_single_window_handle_only_if_IE( ImmediateSession & session, ProcessCloser & pc )
- : session( session ), pc( pc )
+ log_single_window_handle_only_if_IE(ImmediateSession& session, ProcessCloser& pc)
+ : session(session), pc(pc)
{
}
- bool operator()( HWND window )
+ bool operator()(HWND window)
{
- DWORD pid = CreatorProcess( window ) ;
- if ( pc.Contains( pid ) )
+ DWORD pid = CreatorProcess(window);
+ if (pc.Contains(pid))
{
- std::stringstream s ;
- s << "Window handle 0x" << std::hex << window ;
- session.Log( s.str() ) ;
+ std::stringstream s;
+ s << "Window handle 0x" << std::hex << window;
+ session.Log(s.str());
}
- return true ;
+ return true;
}
-} ;
+};
-void log_IE_window_handles( ImmediateSession & session )
+void log_IE_window_handles(ImmediateSession& session)
{
- session.Log( "log_IE_window_handles" ) ;
- const wchar_t * IE_names[] = { L"IExplore.exe", L"AdblockPlusEngine.exe" } ;
- ProcessSnapshot snapshot ;
- ProcessCloser iec(snapshot, IE_names) ;
- log_single_window_handle_only_if_IE lp( session, iec ) ;
- EnumerateWindows( lp ) ;
+ session.Log("log_IE_window_handles");
+ const wchar_t* IE_names[] = { L"IExplore.exe", L"AdblockPlusEngine.exe" };
+ ProcessSnapshot snapshot;
+ ProcessCloser iec(snapshot, IE_names);
+ log_single_window_handle_only_if_IE lp(session, iec);
+ EnumerateWindows(lp);
}
//-------------------------------------------------------
// log_only_window_handle_in_closer
//-------------------------------------------------------
-void log_only_window_handle_in_closer( ImmediateSession & session )
+void log_only_window_handle_in_closer(ImmediateSession& session)
{
- session.Log( "log_only_window_handle_in_closer" ) ;
- const wchar_t * IE_names[] = { L"IExplore.exe", L"AdblockPlusEngine.exe" } ;
- ProcessSnapshot snapshot ;
- ProcessCloser iec( snapshot, IE_names) ;
- iec.IterateOurWindows( log_single_window_handle( session ) ) ;
+ session.Log("log_only_window_handle_in_closer");
+ const wchar_t* IE_names[] = { L"IExplore.exe", L"AdblockPlusEngine.exe" };
+ ProcessSnapshot snapshot;
+ ProcessCloser iec(snapshot, IE_names);
+ iec.IterateOurWindows(log_single_window_handle(session));
}
//-------------------------------------------------------
// sandbox
//-------------------------------------------------------
/**
- * Exposed DLL entry point for custom action.
+ * Exposed DLL entry point for custom action.
* The function signature matches the calling convention used by Windows Installer.
* \param[in] session_handle
* Windows installer session handle
*
- * \return
+ * \return
* An integer interpreted as a custom action return value.
- *
+ *
* \sa
* - MSDN [Custom Action Return Values](http://msdn.microsoft.com/en-us/library/aa368072%28v=vs.85%29.aspx)
*/
-extern "C" UINT __stdcall
-sandbox( MSIHANDLE session_handle )
+extern "C" UINT __stdcall
+sandbox(MSIHANDLE session_handle)
{
- ImmediateSession session( session_handle, "sandbox" ) ;
-
+ ImmediateSession session(session_handle, "sandbox");
+
try
{
- session.Log( "Sandbox timestamp " __TIMESTAMP__ ) ;
- log_only_window_handle_in_closer( session ) ;
+ session.Log("Sandbox timestamp " __TIMESTAMP__);
+ log_only_window_handle_in_closer(session);
}
- catch( std::exception & e )
+ catch (std::exception& e)
{
- session.LogNoexcept( "terminated by exception: " + std::string( e.what() ) ) ;
- return ERROR_INSTALL_FAILURE ;
+ session.LogNoexcept("terminated by exception: " + std::string(e.what()));
+ return ERROR_INSTALL_FAILURE;
}
- catch( ... )
+ catch (...)
{
- session.LogNoexcept( "Caught an exception" ) ;
- return ERROR_INSTALL_FAILURE ;
+ session.LogNoexcept("Caught an exception");
+ return ERROR_INSTALL_FAILURE;
}
- return ERROR_SUCCESS ;
+ return ERROR_SUCCESS;
}
-
« no previous file with comments | « installer/src/installer-lib/test/test-installer-lib-ca.rc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld