Skip to content

Commit

Permalink
Tried, failed to fix globe icon; mvp for related tests
Browse files Browse the repository at this point in the history
(cherry picked from commit 51d4367)
  • Loading branch information
laghee authored and CrisBarreiro committed Jan 20, 2025
1 parent 8800de7 commit 60fa4b0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ class OmnibarLayoutViewModel @Inject constructor(
Error -> GLOBE
NewTab -> SEARCH
SSLWarning -> GLOBE
MaliciousSiteWarning -> GLOBE
else -> SEARCH
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,17 @@ class OmnibarLayoutViewModelTest {
}
}

@Test
fun whenViewModeChangedToMaliciousSiteWarningThenViewStateCorrect() = runTest {
testee.onViewModeChanged(ViewMode.MaliciousSiteWarning)

testee.viewState.test {
val viewState = awaitItem()
assertTrue(viewState.leadingIconState == LeadingIconState.GLOBE)
assertTrue(viewState.scrollingEnabled)
}
}

@Test
fun whenViewModeChangedToNewTabThenViewStateCorrect() = runTest {
testee.onViewModeChanged(ViewMode.NewTab)
Expand Down Expand Up @@ -338,6 +349,17 @@ class OmnibarLayoutViewModelTest {
}
}

@Test
fun whenViewModeChangedToMaliciousSiteWarningAndFocusThenViewStateCorrect() = runTest {
testee.onOmnibarFocusChanged(true, RANDOM_URL)
testee.onViewModeChanged(ViewMode.MaliciousSiteWarning)

testee.viewState.test {
val viewState = expectMostRecentItem()
assertTrue(viewState.leadingIconState == LeadingIconState.SEARCH)
}
}

@Test
fun whenViewModeChangedToNewTabAndFocusThenViewStateCorrect() = runTest {
testee.onOmnibarFocusChanged(true, RANDOM_URL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class RealMaliciousSiteBlockerWebViewIntegrationTest {
dispatchers = coroutineRule.testDispatcherProvider,
appCoroutineScope = coroutineRule.testScope,
isMainProcess = true,
exemptedUrlsHolder = ExemptedUrlsHolder(),
)

@Before
Expand Down

0 comments on commit 60fa4b0

Please sign in to comment.