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

Unified Diff: services/authentication/src/org/chromium/mojo/authentication/accounts_db_manager.h

Issue 1466733002: Google OAuth Device Flow support for FNL (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Added unit tests and fixed bugs in accounts DB. Created 5 years, 1 month 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: services/authentication/src/org/chromium/mojo/authentication/accounts_db_manager.h
diff --git a/services/native_support/process_test_base.h b/services/authentication/src/org/chromium/mojo/authentication/accounts_db_manager.h
similarity index 54%
copy from services/native_support/process_test_base.h
copy to services/authentication/src/org/chromium/mojo/authentication/accounts_db_manager.h
index 6b7900d41199ccf599c00946fb91642e2ad1666d..71a35e35da9b59235934077ba1057f8c2fb4612c 100644
--- a/services/native_support/process_test_base.h
+++ b/services/authentication/src/org/chromium/mojo/authentication/accounts_db_manager.h
@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SERVICES_NATIVE_SUPPORT_PROCESS_TEST_BASE_H_
-#define SERVICES_NATIVE_SUPPORT_PROCESS_TEST_BASE_H_
+#ifndef ACCOUNTS_DB_MANAGER_H_
jln (very slow on Chromium) 2015/12/01 00:08:44 1. Always have the full path reflected in the head
ukode 2015/12/16 19:24:12 Acknowledged.
+#define ACCOUNTS_DB_MANAGER_H_
#include <type_traits>
#include "base/macros.h"
-#include "mojo/public/cpp/application/application_test_base.h"
-#include "mojo/services/native_support/interfaces/process.mojom.h"
+#include "mojo/services/files/interfaces/files.mojom.h"
-namespace native_support {
+namespace authentication {
+namespace accounts_db {
-// TODO(vtl): Stuff copied from mojo/public/cpp/bindings/lib/template_util.h.
+// TODO(ukode): Stuff copied from mojo/public/cpp/bindings/lib/template_util.h.
typedef char YesType;
struct NoType {
@@ -41,7 +41,7 @@ template <typename T>
typename std::enable_if<IsMoveOnlyType<T>::value, T>::type Forward(T& t) {
return t.Pass();
}
-// TODO(vtl): (End of stuff copied from template_util.h.)
+// TODO(ukode): (End of stuff copied from template_util.h.)
template <typename T1>
mojo::Callback<void(T1)> Capture(T1* t1) {
@@ -56,22 +56,32 @@ mojo::Callback<void(T1, T2)> Capture(T1* t1, T2* t2) {
};
}
-class ProcessTestBase : public mojo::test::ApplicationTestBase {
- public:
- ProcessTestBase();
- ~ProcessTestBase() override;
+class AccountsDbManager {
+ public:
+ AccountsDbManager();
- void SetUp() override;
+ AccountsDbManager(mojo::files::FilesPtr files);
- protected:
- ProcessPtr& process() { return process_; }
+ ~AccountsDbManager();
- private:
- ProcessPtr process_;
+ bool UpdateAccount(const mojo::String& username,
+ const mojo::String& account_data);
- DISALLOW_COPY_AND_ASSIGN(ProcessTestBase);
+ void GetAccountDataForUser(const mojo::String& username,
+ mojo::String& user_data);
+
+ mojo::Array<uint8_t> FetchAllAccounts();
+
+ private:
+ bool checkIfUserExists(std::string user_data);
+
+ mojo::files::DirectoryPtr directory_;
+ std::string contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(AccountsDbManager);
};
-} // namespace native_support
+} // namespace accounts_db
+} // namespace authentication
-#endif // SERVICES_NATIVE_SUPPORT_PROCESS_TEST_BASE_H_
+#endif // ACCOUNTS_DB_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698