Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1739)

Unified Diff: chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc

Issue 2705213002: Show different error message if ARC is disabled. (Closed)
Patch Set: Rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc
diff --git a/chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc b/chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc
index 791c6e8f9a51032e1e93d08e84ff68f311947505..06086a7a2a12e569be560977566206184df68c3d 100644
--- a/chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc
+++ b/chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher_browsertest.cc
@@ -123,16 +123,21 @@ class ArcRobotAuthCodeFetcherBrowserTest : public InProcessBrowserTest {
policy::TestRequestInterceptor* interceptor() { return interceptor_.get(); }
- static void FetchAuthCode(ArcRobotAuthCodeFetcher* fetcher,
- std::string* output_auth_code) {
+ static void FetchAuthCode(
+ ArcRobotAuthCodeFetcher* fetcher,
+ arc::ArcAuthInfoFetcher::Status* output_fetch_status,
+ std::string* output_auth_code) {
base::RunLoop run_loop;
fetcher->Fetch(base::Bind(
- [](std::string* output_auth_code, base::RunLoop* run_loop,
+ [](arc::ArcAuthInfoFetcher::Status* output_fetch_status,
+ std::string* output_auth_code, base::RunLoop* run_loop,
+ arc::ArcAuthInfoFetcher::Status fetch_status,
const std::string& auth_code) {
+ *output_fetch_status = fetch_status;
*output_auth_code = auth_code;
run_loop->Quit();
},
- output_auth_code, &run_loop));
+ output_fetch_status, output_auth_code, &run_loop));
// Because the Fetch() operation needs to interact with other threads,
// RunUntilIdle() won't work here. Instead, use Run() and Quit() explicitly
// in the callback.
@@ -151,8 +156,13 @@ IN_PROC_BROWSER_TEST_F(ArcRobotAuthCodeFetcherBrowserTest,
interceptor()->PushJobCallback(base::Bind(&ResponseJob));
std::string auth_code;
+ arc::ArcAuthInfoFetcher::Status fetch_status =
+ arc::ArcAuthInfoFetcher::Status::FAILURE;
+
auto robot_fetcher = base::MakeUnique<ArcRobotAuthCodeFetcher>();
- FetchAuthCode(robot_fetcher.get(), &auth_code);
+ FetchAuthCode(robot_fetcher.get(), &fetch_status, &auth_code);
+
+ EXPECT_EQ(arc::ArcAuthInfoFetcher::Status::SUCCESS, fetch_status);
EXPECT_EQ(kFakeAuthCode, auth_code);
}
@@ -164,9 +174,13 @@ IN_PROC_BROWSER_TEST_F(ArcRobotAuthCodeFetcherBrowserTest,
// We expect auth_code is empty in this case. So initialize with non-empty
// value.
std::string auth_code = "NOT-YET-FETCHED";
+ arc::ArcAuthInfoFetcher::Status fetch_status =
+ arc::ArcAuthInfoFetcher::Status::SUCCESS;
+
auto robot_fetcher = base::MakeUnique<ArcRobotAuthCodeFetcher>();
- FetchAuthCode(robot_fetcher.get(), &auth_code);
+ FetchAuthCode(robot_fetcher.get(), &fetch_status, &auth_code);
+ EXPECT_EQ(arc::ArcAuthInfoFetcher::Status::FAILURE, fetch_status);
// Use EXPECT_EQ for better logging in case of failure.
EXPECT_EQ(std::string(), auth_code);
}

Powered by Google App Engine
This is Rietveld 408576698