You can use the Edit > New Brush (Ctrl+B or ⌘B) to create a brush based on a canvas portion, after you create the brush, you can select the Paint Bucket tool to fill the canvas an replicate the pattern:
You can use the Edit > New Brush (Ctrl+B or ⌘B) to create a brush based on a canvas portion, after you create the brush, you can select the Paint Bucket tool to fill the canvas an replicate the pattern: