Walmart has factors that could work in its favor, including a growing online business and market share gains from higher-income shoppers.