Commit d97cc903 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Add stub for basic crosapi keystore service browser test.

A full test cannot be written right now because the ash instance being
launched does not support attestation. The stub is a browser_test
because there is no infrastructure for creating low-level crosapi
integration tests.

Bug: 1134349, 1134340
Change-Id: I54c47be5d2e22b0efa1dec3d130e1223bffd56a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2443515
Commit-Queue: Erik Chen <erikchen@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813263}
parent 24204336
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include "chrome/test/base/in_process_browser_test.h"
#include "chromeos/crosapi/mojom/keystore_service.mojom-test-utils.h"
#include "chromeos/crosapi/mojom/keystore_service.mojom.h"
#include "chromeos/lacros/lacros_chrome_service_impl.h"
#include "content/public/test/browser_test.h"
// This class provides integration testing for the keystore service crosapi.
// TODO(https://crbug.com/1134340): The logic being tested does not rely on
// //chrome or //content so it would be helpful if this lived in a lower-level
// test suite.
class KeystoreServiceLacrosBrowserTest : public InProcessBrowserTest {
protected:
KeystoreServiceLacrosBrowserTest() = default;
KeystoreServiceLacrosBrowserTest(const KeystoreServiceLacrosBrowserTest&) =
delete;
KeystoreServiceLacrosBrowserTest& operator=(
const KeystoreServiceLacrosBrowserTest&) = delete;
~KeystoreServiceLacrosBrowserTest() override = default;
mojo::Remote<crosapi::mojom::KeystoreService>& keystore_service_remote() {
return chromeos::LacrosChromeServiceImpl::Get()->keystore_service_remote();
}
};
// Tests that providing an incorrectly formatted user keystore challenge returns
// failure.
IN_PROC_BROWSER_TEST_F(KeystoreServiceLacrosBrowserTest, WrongFormattingUser) {
crosapi::mojom::ChallengeAttestationOnlyKeystoreResultPtr result;
std::string challenge = "asdf";
crosapi::mojom::KeystoreServiceAsyncWaiter async_waiter(
keystore_service_remote().get());
async_waiter.ChallengeAttestationOnlyKeystore(
challenge, crosapi::mojom::KeystoreType::kUser, /*migrate=*/false,
&result);
ASSERT_TRUE(result->is_error_message());
// TODO(https://crbug.com/1134349): Currently this errors out because remote
// attestation is disabled. We want this to error out because of a poorly
// formatted attestation message.
}
......@@ -3092,7 +3092,10 @@ if (chromeos_is_browser_only) {
"CHROME_VERSION_MAJOR=" + chrome_version_major,
]
sources = [ "../browser/lacros/screen_manager_lacros_browsertest.cc" ]
sources = [
"../browser/lacros/keystore_service_lacros_browsertest.cc",
"../browser/lacros/screen_manager_lacros_browsertest.cc",
]
deps = [
":browser_tests_runner",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment