Chrysalis - CLO3D Authenticator Extension Test Coverage


integrations/clo3d/extensions/authenticator/src/
File: integrations/clo3d/extensions/authenticator/src/AuthenticatorExtension.cpp
Date: 2026-08-27 18:36:45
Lines:
0/34
0.0%
Functions:
0/6
0.0%
Branches:
0/74
0.0%
Decisions:
0/10
0.0%
Calls:
0/202
0.0%

Line Branch Decision Call Exec Source
1 #include "AuthenticatorExtension.h"
2
3 #define LOGGER_NAME "Authenticator Extension"
4
5 #include <QUrl>
6 #include <QThread>
7 #include <QPointer>
8 #include <QApplication>
9 #include <QDesktopServices>
10 #include <QtCore/private/qhooks_p.h>
11
12 #include "Logging.h"
13 #include "HooksManager.h"
14
15 using namespace CLO3D;
16
17 // TODO:
18 // - Class for qHookData, constructionQueue, loginDialog
19 // - Intercept other HTTP(S) calls
20
21 ✗ extern "C" CLO3D_EXTENSION_ENTRY BaseExtension* create() {
22
0/3
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ return new AuthenticatorExtension();
23 }
24
25 QWidget* loginDialog;
26 QObject* authenticationProcessor;
27 QVector<QPointer<QObject>> constructionQueue;
28
29 ✗ bool isObjectOfClass(const QObject* object, const QString& className) {
30
0/10
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ return className == object->metaObject()->className();
31 }
32
33 ✗ void AuthenticatorExtension::install() {
34
0/3
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ qtHookData[QHooks::AddQObject] = reinterpret_cast<quintptr>(+[](QObject *object) {
35
0/2
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
0/1
✗ Call 0 not invoked.
✗ for (int i = 0; i < constructionQueue.size(); i++) {
36
0/2
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
0/4
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ if (auto pointer = constructionQueue.at(i)) {
37
0/2
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
0/1
✗ Call 0 not invoked.
✗ if (QObject* obj = pointer.data()) {
38
0/2
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
0/8
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 14 not invoked.
✗ Call 17 not invoked.
✗ Call 22 not invoked.
✗ Call 25 not invoked.
✗ if (!authenticationProcessor && isObjectOfClass(obj, "AuthenticationProcessor")) {
39 ✗ authenticationProcessor = obj;
40
0/2
✗ Decision 'true' not taken.
✗ Decision 'false' not taken.
0/8
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 14 not invoked.
✗ Call 17 not invoked.
✗ Call 22 not invoked.
✗ Call 25 not invoked.
✗ } else if (!loginDialog && isObjectOfClass(obj, "CloUICommon::LoginDialog")) {
41
0/1
✗ Call 0 not invoked.
✗ loginDialog = qobject_cast<QWidget*>(obj);
42 }
43 }
44
0/1
✗ Call 0 not invoked.
✗ constructionQueue.removeAt(i);
45 ✗ i--;
46
0/2
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ }
47 }
48
0/8
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ constructionQueue.append(QPointer(object));
49
0/1
✗ Call 0 not invoked.
✗ });
50
0/8
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ HooksManager::addBefore<&QApplication::exec>([](const HookHandle& handle) {
51
0/5
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ loginDialog->dumpObjectInfo();
52
0/4
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ authenticationProcessor->dumpObjectInfo();
53
54
0/4
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ LOG_INFO("Skipping logging in");
55
0/41
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
✗ Call 20 not invoked.
✗ Call 23 not invoked.
✗ Call 24 not invoked.
✗ Call 25 not invoked.
✗ Call 26 not invoked.
✗ Call 27 not invoked.
✗ Call 28 not invoked.
✗ Call 29 not invoked.
✗ Call 30 not invoked.
✗ Call 31 not invoked.
✗ Call 32 not invoked.
✗ Call 33 not invoked.
✗ Call 34 not invoked.
✗ Call 35 not invoked.
✗ Call 36 not invoked.
✗ Call 37 not invoked.
✗ Call 38 not invoked.
✗ Call 39 not invoked.
✗ Call 40 not invoked.
✗ Call 41 not invoked.
✗ Call 42 not invoked.
✗ QMetaObject::invokeMethod(authenticationProcessor, "SucceedAuthentication");
56
0/41
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
✗ Call 20 not invoked.
✗ Call 23 not invoked.
✗ Call 24 not invoked.
✗ Call 25 not invoked.
✗ Call 26 not invoked.
✗ Call 27 not invoked.
✗ Call 28 not invoked.
✗ Call 29 not invoked.
✗ Call 30 not invoked.
✗ Call 31 not invoked.
✗ Call 32 not invoked.
✗ Call 33 not invoked.
✗ Call 34 not invoked.
✗ Call 35 not invoked.
✗ Call 36 not invoked.
✗ Call 37 not invoked.
✗ Call 38 not invoked.
✗ Call 39 not invoked.
✗ Call 40 not invoked.
✗ Call 41 not invoked.
✗ Call 42 not invoked.
✗ QMetaObject::invokeMethod(loginDialog, "SignInWithCloset");
57
58
0/1
✗ Call 0 not invoked.
✗ qtHookData[QHooks::AddQObject] = 0;
59
0/2
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ handle.remove();
60 ✗ });
61
0/4
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ HooksManager::addIgnoreConditionally<&QDesktopServices::openUrl>([](const HookHandle &handle, bool& ignore, bool ret, const QUrl &url) {
62
0/19
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
✗ Call 22 not invoked.
✗ Call 23 not invoked.
✗ Call 24 not invoked.
✗ Call 25 not invoked.
✗ Call 26 not invoked.
✗ if (url.toString().startsWith("https://style.clo-set.com/en/account/signin?productId=40")) {
63
0/21
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 10 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
✗ Call 20 not invoked.
✗ Call 21 not invoked.
✗ Call 22 not invoked.
✗ Call 23 not invoked.
✗ Call 24 not invoked.
✗ Call 25 not invoked.
✗ Call 26 not invoked.
✗ LOG_INFO("Bypassing login URL: {}", url.toString().toStdString());
64
0/1
✗ Call 0 not invoked.
✗ ignore = true;
65 ✗ ret = true;
66 }
67 ✗ });
68 ✗ }
69