Skip to content

Commit 870a6b8

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[cleanup] Remove redundant code and force reset TrackingAsyncActivity
Extracted from https://crrev.com/c/6884624 but that does a lot of changes that affect order of things. So reducing the scope. Bug: none Change-Id: I45164b6c477d25a2f616b38191985cdf1ebb69ee Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6897849 Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org> Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org> Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org>
1 parent 169b45f commit 870a6b8

18 files changed

+18
-65
lines changed

front_end/core/host/AidaClient.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,6 @@ describeWithEnvironment('AidaClient', () => {
559559
});
560560
}
561561

562-
beforeEach(() => {
563-
sinon.restore();
564-
});
565-
566562
it('should return NO_INTERNET when navigator is not online', async () => {
567563
const navigatorDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'navigator')!;
568564
Object.defineProperty(globalThis, 'navigator', {
@@ -631,10 +627,6 @@ describeWithEnvironment('AidaClient', () => {
631627
});
632628

633629
describe('completeCode', () => {
634-
beforeEach(() => {
635-
sinon.restore();
636-
});
637-
638630
it('handles successful response', async () => {
639631
const mockResult: AidaCodeCompleteResult = {
640632
response: JSON.stringify({

front_end/models/ai_assistance/EvaluateAction.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ describe('FreestylerEvaluateAction', () => {
4343
};
4444
}
4545

46-
beforeEach(() => {
47-
sinon.restore();
48-
});
49-
5046
it('should serialize a CDP error as a string', async () => {
5147
assert.strictEqual(await executeWithResult({error: 'errorMessage'}), 'Error: errorMessage');
5248
});

front_end/models/ai_assistance/agents/AiAgent.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ describeWithEnvironment('AiAgent', () => {
5555
sinon.stub(crypto, 'randomUUID').returns('sessionId' as `${string}-${string}-${string}-${string}-${string}`);
5656
});
5757

58-
afterEach(() => {
59-
sinon.restore();
60-
});
61-
6258
it('builds a request with a temperature', async () => {
6359
const agent = new AiAgentMock({
6460
aidaClient: mockAidaClient(),

front_end/models/ai_assistance/agents/FileAgent.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,7 @@ describeWithMockConnection('FileAgent', () => {
3838
});
3939
});
4040

41-
afterEach(() => {
42-
sinon.restore();
43-
});
44-
4541
describe('buildRequest', () => {
46-
beforeEach(() => {
47-
sinon.restore();
48-
});
49-
5042
it('builds a request with a model id', async () => {
5143
mockHostConfig('test model');
5244
const agent = new FileAgent({

front_end/models/ai_assistance/agents/NetworkAgent.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ describeWithMockConnection('NetworkAgent', () => {
4343
});
4444

4545
describe('buildRequest', () => {
46-
beforeEach(() => {
47-
sinon.restore();
48-
});
49-
5046
it('builds a request with a model id', async () => {
5147
mockHostConfig('test model');
5248
const agent = new NetworkAgent({
@@ -134,10 +130,6 @@ describeWithMockConnection('NetworkAgent', () => {
134130
});
135131
});
136132

137-
afterEach(() => {
138-
sinon.restore();
139-
});
140-
141133
it('generates an answer', async () => {
142134
const agent = new NetworkAgent({
143135
aidaClient: mockAidaClient([[{

front_end/models/ai_assistance/agents/PerformanceAgent.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ describeWithEnvironment('PerformanceAgent', () => {
3838
}
3939

4040
describe('buildRequest', () => {
41-
beforeEach(() => {
42-
sinon.restore();
43-
});
44-
4541
it('builds a request with a model id', async () => {
4642
mockHostConfig('test model');
4743
const agent = new PerformanceAgent(

front_end/models/ai_assistance/agents/StylingAgent.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ describeWithEnvironment('StylingAgent', () => {
125125
sinon.stub(crypto, 'randomUUID').returns('sessionId' as `${string}-${string}-${string}-${string}-${string}`);
126126
});
127127

128-
afterEach(() => {
129-
sinon.restore();
130-
});
131-
132128
it('builds a request with a model id', async () => {
133129
mockHostConfig('test model');
134130
const agent = new StylingAgent({

front_end/models/ai_code_completion/AiCodeCompletion.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describeWithEnvironment('AiCodeCompletion', () => {
2727
});
2828

2929
afterEach(() => {
30-
sinon.restore();
30+
clock.restore();
3131
});
3232

3333
it('builds a request and calls the AIDA client on text changed', async () => {

front_end/panels/application/StorageView.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ describeWithMockConnection('StorageView', () => {
2525
domStorageModel = target.model(Resources.DOMStorageModel.DOMStorageModel);
2626
domStorageModel?.enable();
2727
storageKeyManager = target.model(SDK.StorageKeyManager.StorageKeyManager);
28+
sinon.stub(target.networkAgent(), 'invoke_getCookies').returns(Promise.resolve({
29+
cookies: [] as Protocol.Network.Cookie[],
30+
} as Protocol.Network.GetCookiesResponse));
2831
});
2932

3033
expectConsoleLogs({

front_end/panels/common/AiCodeCompletionDisclaimer.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ describeWithEnvironment('AiCodeCompletionDisclaimer', () => {
2121
return {view, widget};
2222
}
2323

24-
afterEach(() => {
25-
sinon.restore();
26-
});
27-
2824
it('should show disclaimer with no logging text when enterprise policy value is ALLOW_WITHOUT_LOGGING', async () => {
2925
updateHostConfig({
3026
aidaAvailability: {enterprisePolicyValue: Root.Runtime.GenAiEnterprisePolicyValue.ALLOW_WITHOUT_LOGGING},

0 commit comments

Comments
 (0)