Migrate base::OptionalOrNullptr() to base::OptionalToPtr() in //net/dns.

This also updates the includes to the new location, since this helper
has been split out of //base/stl_util.h

These CLs were automatically generated using the following commands:

sed -i s^OptionalOrNullptr^OptionalToPtr^g $(git gs OptionalOrNullptr --name-only | grep -v base | grep -v audit_non_blink_usage.py) and then git cl format
git commit -a -m "Step 1"
tools/add_header.py --remove --header '"base/stl_util.h"' $(grep -l -P "base::to_underlying|base::GetUnderlyingContainer|base::STLClearObject|base::STLCount|base::ConstCastIterator|base::STLSetDifference|base::STLSetUnion|base::STLSetIntersection|base::IsNotIn" $(git diff HEAD^..HEAD --name-only))
git commit -a -m "Step 2"
tools/add_header.py --header '"base/types/optional_util.h"' $(git diff HEAD^^..HEAD^ --name-only)
git commit -a -m "Step 3"

And then using git cl split on the resulting diff.

This CL was uploaded by git cl split.

[email protected]

Bug: 1356184
Change-Id: Ibfd4a9aabcb5f064ff9f23d5b64b1e325a91ca89
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3860950
Auto-Submit: Daniel Cheng <[email protected]>
Reviewed-by: Dan McArdle <[email protected]>
Commit-Queue: Dan McArdle <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1040468}
diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc
index fd2e535..a5d8e57c 100644
--- a/net/dns/dns_test_util.cc
+++ b/net/dns/dns_test_util.cc
@@ -20,6 +20,7 @@
 #include "base/task/single_thread_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/time/time.h"
+#include "base/types/optional_util.h"
 #include "net/base/io_buffer.h"
 #include "net/base/ip_address.h"
 #include "net/base/ip_endpoint.h"
@@ -543,15 +544,14 @@
       case MockDnsClientRule::ResultType::kFail: {
         int error = result_.net_error.value_or(ERR_NAME_NOT_RESOLVED);
         DCHECK_NE(error, OK);
-        std::move(callback_).Run(error,
-                                 base::OptionalOrNullptr(result_.response));
+        std::move(callback_).Run(error, base::OptionalToPtr(result_.response));
         break;
       }
       case MockDnsClientRule::ResultType::kEmpty:
       case MockDnsClientRule::ResultType::kOk:
       case MockDnsClientRule::ResultType::kMalformed:
         DCHECK(!result_.net_error.has_value());
-        std::move(callback_).Run(OK, base::OptionalOrNullptr(result_.response));
+        std::move(callback_).Run(OK, base::OptionalToPtr(result_.response));
         break;
       case MockDnsClientRule::ResultType::kTimeout:
         DCHECK(!result_.net_error.has_value());