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

Side by Side Diff: installer/src/installer-lib/test/test-installer-lib-sandbox.cpp

Issue 4790070691233792: Case-insensitive string class (Closed)
Patch Set: Created March 30, 2014, 7:49 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * \file test-installer-lib-sandbox.cpp 2 * \file test-installer-lib-sandbox.cpp
3 * 3 *
4 * Automatic testing of many of the units within the custom action is infeasible . 4 * Automatic testing of many of the units within the custom action is infeasible .
5 * In one case, they rely on the execution environment within an installation se ssion. 5 * In one case, they rely on the execution environment within an installation se ssion.
6 * In another, they rely on the operation system environment as a whole. 6 * In another, they rely on the operation system environment as a whole.
7 * In these cases, it's easier to verify behavior manually. 7 * In these cases, it's easier to verify behavior manually.
8 * 8 *
9 * This file contains a custom action function sandbox() as well as a number of test functions. 9 * This file contains a custom action function sandbox() as well as a number of test functions.
10 * At any given time, not all of the test functions need to be referenced within the body of custom action. 10 * At any given time, not all of the test functions need to be referenced within the body of custom action.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 return true ; 75 return true ;
76 } 76 }
77 } ; 77 } ;
78 78
79 void log_IE_window_handles( Immediate_Session & session ) 79 void log_IE_window_handles( Immediate_Session & session )
80 { 80 {
81 session.log( "log_IE_window_handles" ) ; 81 session.log( "log_IE_window_handles" ) ;
82 const wchar_t * IE_names[] = { L"IExplore.exe", L"AdblockPlusEngine.exe" } ; 82 const wchar_t * IE_names[] = { L"IExplore.exe", L"AdblockPlusEngine.exe" } ;
83 Snapshot snapshot ; 83 Snapshot snapshot ;
84 Process_Closer iec( snapshot, IE_names, 2 ) ; 84 Process_Closer iec( snapshot, IE_names ) ;
85 log_single_window_handle_only_if_IE lp( session, iec ) ; 85 log_single_window_handle_only_if_IE lp( session, iec ) ;
86 enumerate_windows( lp ) ; 86 enumerate_windows( lp ) ;
87 } 87 }
88 88
89 //------------------------------------------------------- 89 //-------------------------------------------------------
90 // log_only_window_handle_in_closer 90 // log_only_window_handle_in_closer
91 //------------------------------------------------------- 91 //-------------------------------------------------------
92 void log_only_window_handle_in_closer( Immediate_Session & session ) 92 void log_only_window_handle_in_closer( Immediate_Session & session )
93 { 93 {
94 session.log( "log_only_window_handle_in_closer" ) ; 94 session.log( "log_only_window_handle_in_closer" ) ;
95 const wchar_t * IE_names[] = { L"IExplore.exe", L"AdblockPlusEngine.exe" } ; 95 const wchar_t * IE_names[] = { L"IExplore.exe", L"AdblockPlusEngine.exe" } ;
96 Snapshot snapshot ; 96 Snapshot snapshot ;
97 Process_Closer iec( snapshot, IE_names, 2 ) ; 97 Process_Closer iec( snapshot, IE_names ) ;
98 iec.iterate_our_windows( log_single_window_handle( session ) ) ; 98 iec.iterate_our_windows( log_single_window_handle( session ) ) ;
99 } 99 }
100 100
101 //------------------------------------------------------- 101 //-------------------------------------------------------
102 // sandbox 102 // sandbox
103 //------------------------------------------------------- 103 //-------------------------------------------------------
104 /** 104 /**
105 * Exposed DLL entry point for custom action. 105 * Exposed DLL entry point for custom action.
106 * The function signature matches the calling convention used by Windows Install er. 106 * The function signature matches the calling convention used by Windows Install er.
107 107
108 * \param[in] session_handle 108 * \param[in] session_handle
109 * Windows installer session handle 109 * Windows installer session handle
110 * 110 *
111 * \return 111 * \return
112 * An integer interpreted as a custom action return value. 112 * An integer interpreted as a custom action return value.
113 * 113 *
114 * \sa 114 * \sa
115 * - MSDN [Custom Action Return Values](http://msdn.microsoft.com/en-us/librar y/aa368072%28v=vs.85%29.aspx) 115 * - MSDN [Custom Action Return Values](http://msdn.microsoft.com/en-us/librar y/aa368072%28v=vs.85%29.aspx)
116 */ 116 */
117 extern "C" UINT __stdcall 117 extern "C" UINT __stdcall
118 sandbox( MSIHANDLE session_handle ) 118 sandbox( MSIHANDLE session_handle )
119 { 119 {
120 Immediate_Session session( session_handle, "sandbox" ) ; 120 Immediate_Session session( session_handle, "sandbox" ) ;
121 121
122 try 122 try
123 { 123 {
124 session.log( "Sandbox timestamp " __TIMESTAMP__ ) ;
124 log_only_window_handle_in_closer( session ) ; 125 log_only_window_handle_in_closer( session ) ;
125 } 126 }
126 catch( std::exception & e ) 127 catch( std::exception & e )
127 { 128 {
128 session.log_noexcept( "terminated by exception: " + std::string( e.what() ) ) ; 129 session.log_noexcept( "terminated by exception: " + std::string( e.what() ) ) ;
129 return ERROR_INSTALL_FAILURE ; 130 return ERROR_INSTALL_FAILURE ;
130 } 131 }
131 catch( ... ) 132 catch( ... )
132 { 133 {
133 session.log_noexcept( "Caught an exception" ) ; 134 session.log_noexcept( "Caught an exception" ) ;
134 return ERROR_INSTALL_FAILURE ; 135 return ERROR_INSTALL_FAILURE ;
135 } 136 }
136 137
137 return ERROR_SUCCESS ; 138 return ERROR_SUCCESS ;
138 } 139 }
139 140
OLDNEW
« installer/src/installer-lib/process.h ('K') | « installer/src/installer-lib/test/process_test.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld