San Diego (CNN) The narrow contest between Hillary Clinton and Bernie Sanders in California is proving to be the ultimate test of the Clinton political machine.

Clinton is almost certain to clinch the Democratic nomination by the time the California race is decided on June 7. But with Sanders suddenly taking off in the polls, the Clinton campaign is leaving nothing to chance and pulling out all the stops to avoid ending the primary season with an embarrassing, if only symbolic, loss to Sanders.

As she spends the next few days crisscrossing California, Clinton is relying heavily on her relationships with California politicians -- some that go back decades. Her army of surrogates include national Democratic leaders like Sen. Barbara Boxer as well as scores of local elected officials. This network of supporters has been particularly critical to the campaign's outreach to non-white voters -- an expansive effort that includes multi-lingual phone banks and TV ads.

Even Jerry Brown, the state's governor who lost a contentious presidential primary here to Clinton's husband in 1992, is on board. Her biggest surrogate, Bill Clinton, has also been a constant presence in the state and has numerous campaign stops scheduled in the next few days.

The widespread support that Clinton is receiving from local officials is in stark contrast to Sanders, who has not received any notable political endorsements in the state. The Clinton network's success will not only help decide whether she can finally put away Sanders -- who insists he will take his candidacy to the convention next month -- but will also provide clues about how successful her political machine will be against another outsider candidate: Donald Trump.

"The Clintons are benefiting from nearly three decades of relationship cultivation in the state -- both from a political standpoint as well as a donor standpoint," veteran California political strategist Brian Brokaw said. "There are people in California who are loyal to the end to the Clintons."

Forceful repudiation of Trump

Clinton kicked off her multi-day California swing Thursday by unleashing her most forceful repudiation yet of Trump. She delivered a scathing speech in San Diego -- home to a large military population -- mocking Trump's "bizarre fascination with dictators and strongmen" and calling him "temperamentally unfit" to be president.

"Donald Trump's ideas aren't just different -- they are dangerously incoherent," Clinton said. "They're not even really ideas, just a series of bizarre rants, personal feuds and outright lies. He is not just unprepared. He is temperamentally unfit to hold an office that requires knowledge, stability and immense responsibly."

Signaling that the Democratic nomination is all but hers, Clinton did not once mention Sanders in her speech. But the Vermont senator has vowed to remain in the race through the District of Columbia's June 14 primary and possibly even next month's convention.

His decision to camp out in California seems to have given him a boost.

A series of recent polls have shown Clinton and Sanders running in a tight race here -- a contrast from earlier in the year, when Clinton sometimes led her rival by double digits. An NBC News/Wall Street Journal/Marist poll out Wednesday showed Clinton narrowly ahead of Sanders, 49% to 47%.

The unexpectedly tight race underscores the degree to which Clinton is still struggling to rally the base behind her candidacy, including her challenge in winning over millennials. It also raises the question of whether the assumption inside her campaign -- that opposition to Trump will automatically unify the party -- is a flawed premise.

"It's a big prize. It might say more than it means if Sanders were to win it," said John Burton, chairman of the California Democratic Party. "It's going to say something about the strength and the mood of the progressives and the liberals."

The Clintons have a long history with the state. California twice helped elect Bill Clinton president in the 1990s, and in 2008, Hillary Clinton defeated Barack Obama in the California primary, which was held in February that year.

Personal ties

And the couple's attachment to the state is not just limited to politics. Soon after they began dating, the Clintons lived together in Berkeley in the summer of 1971 while Hillary Clinton worked at a law firm.

Now, suddenly confronting the possibility of defeat in a state where they have deep ties, Hillary Clinton's campaign has ramped up its efforts. It appointed Buffy Wicks, a veteran of both Obama campaigns, as state director, and has opened offices in 11 cities. The campaign also went up with TV ads for the first time last Friday, beginning with a modest six-figure ad buy in the Fresno, Sacramento and Los Angeles areas.

Current and past public officials including Boxer, ex-Secretary of Labor Hilda Solis, San Francisco Mayor Ed Lee, Los Angeles Mayor Eric Garcetti and the state's Lt. Gov. Gavin Newsom have participated in get-out-the-vote efforts across the state, volunteering at phone banks, speaking at rallies, marching in parades and helping open local campaign offices.

Coming at the final stretch of the primary season, the California contest is testing what the Clinton campaign considers its decisive advantages over Sanders: Clinton's strength with minority voters, her expansive network of surrogates and relationships with donors dating back decades, as well as a sophisticated political operation perhaps better prepared than any other to divide-and-conquer the country's most populous state.

Most notable are the campaign's extensive efforts to reach the state's non-white voters. It is conducting phone banks in Spanish, Mandarin, Korean, Cantonese, Vietnamese and Tagalog, and minority surrogates have been key in outreach efforts to major constituent groups like Latinos and Asian-Americans.

Ricardo Lara, an openly gay Latino state senator who represents parts of southeast Los Angeles, marched in the Long Beach pride parade on behalf of the Clinton campaign last month, alongside "LGBT for Hillary" supporters.

"Surrogates play an exceptionally important role in California given its size and diversity," Lara said. "Ensuring that the campaign has surrogates look and represent the new reality in California is essential."

Morgan Freeman and civil rights activist Dolores Huerta star in two of the TV ads currently on the air; another spot, called "Our Community," features a handful of Asian-American elected officials who have endorsed Clinton. That ad has been translated into Mandarin, Korean, Vietnamese and Cantonese to target minority-heavy areas.

Rep. Judy Chu, who chairs the Congressional Asian Pacific American Caucus, is one of the faces featured in that commercial. CAPAC's leadership PAC endorsed Clinton this week at an event in San Gabriel, and the next night, Chu attended a phone bank targeting Asian-American voters.

'Clear message'

All of this, Chu said, helps send "a clear message that those of us who have been elected by them that (Clinton) is the right choice for this race."

Victory in California will make Clinton's nomination "decisive," she added.

"It would end all speculation that she can be contested for the presidential nomination," Chu said. "It would make it abundantly clear that Bernie Sanders cannot possibly take over this nomination and that Hillary Clinton is the rightful nominee."

Steve Westly, the state's former controller and a prominent Democratic fundraiser supporting Clinton, said it's difficult to overstate Clinton's long history with the state.

"We're almost like a country, it is such a huge state," Westly said. "You have someone like Mrs. Clinton who's been here I don't know, a hundred times over the last two decades -- it's just hard to beat that in 11 or 12 days."