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

Unified Diff: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc

Issue 2476783002: Adding a destination platform histogram for UMA. (Closed)
Patch Set: Style fixes, git cl lint/format Created 4 years, 1 month 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: chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc
diff --git a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc
index 8b083e680322106c1ec74113c68d402cd719316a..a80d4f05ff41942a802edab0f2468c33a76f3a12 100644
--- a/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc
+++ b/chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle_unittest.cc
@@ -143,6 +143,58 @@ TEST(ArcNavigationThrottleTest, TestGetAppIndex) {
2u, ArcNavigationThrottle::GetAppIndex(CreateArray(3, 2), package_name));
}
+TEST(ArcNavigationThrottleTest, TestGetDestinationPlatform) {
+ const std::string chrome_app =
+ ArcIntentHelperBridge::kArcIntentHelperPackageName;
+ const std::string non_chrome_app = "fake_package";
+
+ // When the CloseReason is either ERROR or DIALOG_DEACTIVATED we MUST stay in
+ // Chrome not taking into account the selected_app_package.
+ EXPECT_EQ(ArcNavigationThrottle::Platform::CHROME,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ chrome_app, ArcNavigationThrottle::CloseReason::ERROR));
+ EXPECT_EQ(ArcNavigationThrottle::Platform::CHROME,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ non_chrome_app, ArcNavigationThrottle::CloseReason::ERROR));
+ EXPECT_EQ(
+ ArcNavigationThrottle::Platform::CHROME,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ chrome_app, ArcNavigationThrottle::CloseReason::DIALOG_DEACTIVATED));
+ EXPECT_EQ(ArcNavigationThrottle::Platform::CHROME,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ non_chrome_app,
+ ArcNavigationThrottle::CloseReason::DIALOG_DEACTIVATED));
+
+ // Under any other CloseReason, stay in Chrome only if the package is Chrome.
+ // Otherwise redirect to ARC.
+ EXPECT_EQ(
+ ArcNavigationThrottle::Platform::CHROME,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ chrome_app, ArcNavigationThrottle::CloseReason::ALWAYS_PRESSED));
+ EXPECT_EQ(
+ ArcNavigationThrottle::Platform::CHROME,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ chrome_app, ArcNavigationThrottle::CloseReason::JUST_ONCE_PRESSED));
+ EXPECT_EQ(ArcNavigationThrottle::Platform::CHROME,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ chrome_app,
+ ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND));
+
+ // Go to ARC on any other case.
+ EXPECT_EQ(
+ ArcNavigationThrottle::Platform::ARC,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ non_chrome_app, ArcNavigationThrottle::CloseReason::ALWAYS_PRESSED));
+ EXPECT_EQ(ArcNavigationThrottle::Platform::ARC,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ non_chrome_app,
+ ArcNavigationThrottle::CloseReason::JUST_ONCE_PRESSED));
+ EXPECT_EQ(ArcNavigationThrottle::Platform::ARC,
+ ArcNavigationThrottle::GetDestinationPlatform(
+ non_chrome_app,
+ ArcNavigationThrottle::CloseReason::PREFERRED_ACTIVITY_FOUND));
+}
+
TEST(ArcNavigationThrottleTest, TestIsSwapElementsNeeded) {
std::pair<size_t, size_t> indices;
for (size_t i = 1; i <= ArcNavigationThrottle::kMaxAppResults; ++i) {

Powered by Google App Engine
This is Rietveld 408576698