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

Unified Diff: chromeos/cryptohome/mock_homedir_methods.cc

Issue 2540683002: Don't defer quitting in ExecuteScript and other helpers that use DOMMessageQueue. (Closed)
Patch Set: Address comments. Created 4 years 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: chromeos/cryptohome/mock_homedir_methods.cc
diff --git a/chromeos/cryptohome/mock_homedir_methods.cc b/chromeos/cryptohome/mock_homedir_methods.cc
index dfc506f99028a86ba36022ae09f4ab51536dabb3..65eb516fc09cbed0bcde891120de310fbce80c1c 100644
--- a/chromeos/cryptohome/mock_homedir_methods.cc
+++ b/chromeos/cryptohome/mock_homedir_methods.cc
@@ -15,11 +15,6 @@ using ::testing::_;
namespace cryptohome {
-MockHomedirMethods::MockHomedirMethods()
- : success_(false), return_code_(cryptohome::MOUNT_ERROR_NONE) {}
-
-MockHomedirMethods::~MockHomedirMethods() {}
-
void MockHomedirMethods::SetUp(bool success, MountError return_code) {
success_ = success;
return_code_ = return_code;
@@ -29,8 +24,9 @@ void MockHomedirMethods::SetUp(bool success, MountError return_code) {
WithArgs<2>(Invoke(this, &MockHomedirMethods::DoCallback)));
ON_CALL(*this, MountEx(_, _, _, _)).WillByDefault(
WithArgs<3>(Invoke(this, &MockHomedirMethods::DoMountCallback)));
- ON_CALL(*this, AddKeyEx(_, _, _, _, _)).WillByDefault(
- WithArgs<4>(Invoke(this, &MockHomedirMethods::DoCallback)));
+ ON_CALL(*this, AddKeyEx(_, _, _, _, _))
+ .WillByDefault(
+ WithArgs<4>(Invoke(this, &MockHomedirMethods::DoAddKeyCallback)));
ON_CALL(*this, UpdateKeyEx(_, _, _, _, _)).WillByDefault(
WithArgs<4>(Invoke(this, &MockHomedirMethods::DoCallback)));
ON_CALL(*this, RemoveKeyEx(_, _, _, _)).WillByDefault(
@@ -48,6 +44,14 @@ void MockHomedirMethods::DoGetDataCallback(const GetKeyDataCallback& callback) {
void MockHomedirMethods::DoMountCallback(const MountCallback& callback) {
callback.Run(
success_, return_code_, MockAsyncMethodCaller::kFakeSanitizedUsername);
+ if (!on_mount_called_.is_null())
+ on_mount_called_.Run();
+}
+
+void MockHomedirMethods::DoAddKeyCallback(const Callback& callback) {
+ callback.Run(success_, return_code_);
+ if (!on_add_key_called_.is_null())
+ on_add_key_called_.Run();
}
} // namespace cryptohome

Powered by Google App Engine
This is Rietveld 408576698