Electron cyclotron resonance heating (ECRH) systems for next-step large fusion devices operate in continuous wave power in the multimegawatt range. The unique feature of narrow and well-localized power deposition assigns a key role to ECRH for different tasks, such as plasma start-up, electron heating, current drive, magnetohydrodynamic (MHD) control and profile shaping. The integration of high-power microwave diplexers in the transmission lines will improve the flexibility and efficiency while simultaneously reducing the complexity of large ECRH systems. They can serve as power or beam combiners, as slow and fast directional switches to toggle the power from continuously operating gyrotrons between two launchers, and as discriminators of low-power electron cyclotron emission (ECE) signals from high-power ECRH using a common transmission line and antenna. Among various design options a resonant diplexer with a narrow resonance was selected for application at ASDEX Upgrade. The design is driven by the specific physics requirements for MHD control experiments and possible use for line-of-sight ECE. The compact, waveguide-compatible design features a feedback-controlled mirror drive for tracking of the resonator to the gyrotron frequency. High-power, long-pulse tests were performed with the 140-GHz ECRH system for the stellarator W7-X. Results on the transmission characteristics, power combination, and stationary and controlled distribution of the input power to two outputs are presented. The qualification for in-line ECE was investigated.