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

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: Fix browsertests and add a new test for 904 Arc Disabled Created 3 years, 10 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..059d623e0bccbf04ab80562b47002ef7b2bc40a1 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
@@ -124,15 +124,19 @@ class ArcRobotAuthCodeFetcherBrowserTest : public InProcessBrowserTest {
policy::TestRequestInterceptor* interceptor() { return interceptor_.get(); }
static void FetchAuthCode(ArcRobotAuthCodeFetcher* fetcher,
+ arc::ArcAuthInfoFetchStatus* 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::ArcAuthInfoFetchStatus* output_fetch_status,
+ std::string* output_auth_code, base::RunLoop* run_loop,
+ arc::ArcAuthInfoFetchStatus 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 +155,12 @@ IN_PROC_BROWSER_TEST_F(ArcRobotAuthCodeFetcherBrowserTest,
interceptor()->PushJobCallback(base::Bind(&ResponseJob));
std::string auth_code;
+ arc::ArcAuthInfoFetchStatus fetch_status = arc::ArcAuthInfoFetchStatus::SIZE;
+
auto robot_fetcher = base::MakeUnique<ArcRobotAuthCodeFetcher>();
- FetchAuthCode(robot_fetcher.get(), &auth_code);
+ FetchAuthCode(robot_fetcher.get(), &fetch_status, &auth_code);
+
+ EXPECT_EQ(arc::ArcAuthInfoFetchStatus::SUCCESS, fetch_status);
EXPECT_EQ(kFakeAuthCode, auth_code);
}
@@ -164,9 +172,12 @@ 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::ArcAuthInfoFetchStatus fetch_status = arc::ArcAuthInfoFetchStatus::SIZE;
+
auto robot_fetcher = base::MakeUnique<ArcRobotAuthCodeFetcher>();
- FetchAuthCode(robot_fetcher.get(), &auth_code);
+ FetchAuthCode(robot_fetcher.get(), &fetch_status, &auth_code);
+ EXPECT_EQ(arc::ArcAuthInfoFetchStatus::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