diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-07-29 22:29:40 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 22:29:40 +0900 |
commit | 5592b02a1500062628063862158116f382f3d8e2 (patch) | |
tree | 5c29d29a8fa1aa14f4f6407a66bcaf528c42555c /test/background/mock | |
parent | 75236e9a41788f64df61b14a99e78aedc548e0ad (diff) | |
parent | 1160cf8aedf9810a76d84e3d99a72365e8aeae8a (diff) |
Merge pull request #1213 from ueokande/cross-frame-search
Cross frame search
Diffstat (limited to 'test/background/mock')
-rw-r--r-- | test/background/mock/MockFindClient.ts | 23 | ||||
-rw-r--r-- | test/background/mock/MockFindRepository.ts | 31 | ||||
-rw-r--r-- | test/background/mock/MockFramePresenter.ts | 7 | ||||
-rw-r--r-- | test/background/mock/MockTabPresenter.ts | 4 |
4 files changed, 65 insertions, 0 deletions
diff --git a/test/background/mock/MockFindClient.ts b/test/background/mock/MockFindClient.ts new file mode 100644 index 0000000..dd6d8f3 --- /dev/null +++ b/test/background/mock/MockFindClient.ts @@ -0,0 +1,23 @@ +import FindClient from "../../../src/background/clients/FindClient"; + +export default class MockFindClient implements FindClient { + findNext( + _tabId: number, + _frameId: number, + _keyword: string + ): Promise<boolean> { + throw new Error("not implemented"); + } + + findPrev( + _tabId: number, + _frameId: number, + _keyword: string + ): Promise<boolean> { + throw new Error("not implemented"); + } + + clearSelection(_tabId: number, _frameId: number): Promise<void> { + throw new Error("not implemented"); + } +} diff --git a/test/background/mock/MockFindRepository.ts b/test/background/mock/MockFindRepository.ts new file mode 100644 index 0000000..d5151f8 --- /dev/null +++ b/test/background/mock/MockFindRepository.ts @@ -0,0 +1,31 @@ +import FindRepository, { + FindState, +} from "../../../src/background/repositories/FindRepository"; + +export default class MockFindRepository implements FindRepository { + private globalKeyword: string | undefined; + private localStates: { [tabId: number]: FindState } = {}; + + getGlobalKeyword(): Promise<string | undefined> { + return Promise.resolve(this.globalKeyword); + } + + setGlobalKeyword(keyword: string): Promise<void> { + this.globalKeyword = keyword; + return Promise.resolve(); + } + + getLocalState(tabId: number): Promise<FindState | undefined> { + return Promise.resolve(this.localStates[tabId]); + } + + setLocalState(tabId: number, state: FindState): Promise<void> { + this.localStates[tabId] = state; + return Promise.resolve(); + } + + deleteLocalState(tabId: number): Promise<void> { + delete this.localStates[tabId]; + return Promise.resolve(); + } +} diff --git a/test/background/mock/MockFramePresenter.ts b/test/background/mock/MockFramePresenter.ts new file mode 100644 index 0000000..d688780 --- /dev/null +++ b/test/background/mock/MockFramePresenter.ts @@ -0,0 +1,7 @@ +import FramePresenter from "../../../src/background/presenters/FramePresenter"; + +export default class MockFramePresenter implements FramePresenter { + getAllFrameIds(): Promise<number[]> { + throw new Error("not implemented"); + } +} diff --git a/test/background/mock/MockTabPresenter.ts b/test/background/mock/MockTabPresenter.ts index 22fb947..0968e44 100644 --- a/test/background/mock/MockTabPresenter.ts +++ b/test/background/mock/MockTabPresenter.ts @@ -176,4 +176,8 @@ export default class MockTabPresenter implements TabPresenter { this.zooms[index] = factor; return Promise.resolve(); } + + toggleReaderMode(_tabId: number): Promise<void> { + throw new Error("not implemented"); + } } |