Commit 7e70b5eb authored by David Jacobo's avatar David Jacobo Committed by Commit Bot

Rename ArcNavigationThrottle

After intent picker taking a more generic role (not used for ARC apps
only), AppsNavigationThrottle was introduced, which implements the
throttle logic ArcNavigationThrottle was responsible for before.

This CL proposes renaming ArcNavigationThrottle to
ArcIntentPickerAppFetcher so it reflects more accurately its usage.

Bug: 915852
Test: Previous unit/browser tests passing.
Change-Id: I5fceb11524ddac2b74345ce4924aaf3ebfba3b12
Reviewed-on: https://chromium-review.googlesource.com/c/1483704Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Commit-Queue: David Jacobo <djacobo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635238}
parent f26a1aaa
......@@ -508,8 +508,8 @@ source_set("chromeos") {
"arc/input_method_manager/input_connection_impl.h",
"arc/intent_helper/arc_external_protocol_dialog.cc",
"arc/intent_helper/arc_external_protocol_dialog.h",
"arc/intent_helper/arc_navigation_throttle.cc",
"arc/intent_helper/arc_navigation_throttle.h",
"arc/intent_helper/arc_intent_picker_app_fetcher.cc",
"arc/intent_helper/arc_intent_picker_app_fetcher.h",
"arc/intent_helper/arc_settings_service.cc",
"arc/intent_helper/arc_settings_service.h",
"arc/intent_helper/intent_picker_controller.cc",
......@@ -2196,7 +2196,7 @@ source_set("unit_tests") {
"arc/input_method_manager/test_input_method_manager_bridge.cc",
"arc/input_method_manager/test_input_method_manager_bridge.h",
"arc/intent_helper/arc_external_protocol_dialog_unittest.cc",
"arc/intent_helper/arc_navigation_throttle_unittest.cc",
"arc/intent_helper/arc_intent_picker_app_fetcher_unittest.cc",
"arc/intent_helper/arc_settings_service_unittest.cc",
"arc/intent_helper/open_with_menu_unittest.cc",
"arc/kiosk/arc_kiosk_bridge_unittest.cc",
......
......@@ -16,7 +16,7 @@
#include "chrome/browser/chromeos/apps/intent_helper/page_transition_util.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/arc/arc_web_contents_data.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/extensions/menu_manager.h"
#include "chrome/browser/prerender/prerender_contents.h"
......@@ -168,7 +168,7 @@ void AppsNavigationThrottle::ShowIntentPickerBubble(
content::WebContents* web_contents,
IntentPickerAutoDisplayService* ui_auto_display_service,
const GURL& url) {
arc::ArcNavigationThrottle::GetArcAppsForPicker(
arc::ArcIntentPickerAppFetcher::GetArcAppsForPicker(
web_contents, url,
base::BindOnce(
&AppsNavigationThrottle::FindPwaForUrlAndShowIntentPickerForApps,
......@@ -199,7 +199,7 @@ void AppsNavigationThrottle::OnIntentPickerClosed(
}
break;
case apps::mojom::AppType::kArc:
if (arc::ArcNavigationThrottle::MaybeLaunchOrPersistArcApp(
if (arc::ArcIntentPickerAppFetcher::MaybeLaunchOrPersistArcApp(
url, launch_name, should_launch_app, should_persist)) {
CloseOrGoBack(web_contents);
} else {
......@@ -212,7 +212,7 @@ void AppsNavigationThrottle::OnIntentPickerClosed(
// since chrome browser is neither a PWA or ARC app.
if (close_reason == chromeos::IntentPickerCloseReason::STAY_IN_CHROME &&
should_persist) {
arc::ArcNavigationThrottle::MaybeLaunchOrPersistArcApp(
arc::ArcIntentPickerAppFetcher::MaybeLaunchOrPersistArcApp(
url, launch_name, /*should_launch_app=*/false,
/*should_persist=*/true);
}
......@@ -535,15 +535,16 @@ AppsNavigationThrottle::HandleRequest() {
return content::NavigationThrottle::PROCEED;
if (arc_enabled_ &&
arc::ArcNavigationThrottle::WillGetArcAppsForNavigation(
arc::ArcIntentPickerAppFetcher::WillGetArcAppsForNavigation(
handle,
base::BindOnce(&AppsNavigationThrottle::OnDeferredNavigationProcessed,
weak_factory_.GetWeakPtr()))) {
// Handling is now deferred to ArcNavigationThrottle, which asynchronously
// queries ARC for apps, and runs OnDeferredNavigationProcessed() with an
// action based on whether an acceptable app was found and user consent to
// open received. We assume the UI is shown or a preferred app was found;
// reset to false if we resume the navigation.
// Handling is now deferred to ArcIntentPickerAppFetcher, which
// asynchronously queries ARC for apps, and runs
// OnDeferredNavigationProcessed() with an action based on whether an
// acceptable app was found and user consent to open received. We assume the
// UI is shown or a preferred app was found; reset to false if we resume the
// navigation.
ui_displayed_ = true;
return content::NavigationThrottle::DEFER;
}
......
......@@ -13,7 +13,7 @@
#include "chrome/browser/chromeos/apps/intent_helper/apps_navigation_types.h"
#include "chrome/browser/chromeos/apps/intent_helper/page_transition_util.h"
#include "chrome/browser/chromeos/arc/arc_web_contents_data.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.h"
#include "chrome/browser/chromeos/external_protocol_dialog.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/browser.h"
......@@ -377,7 +377,7 @@ void OnIntentPickerClosed(int render_process_host_id,
// If the user selected an app to continue the navigation, confirm that the
// |package_name| matches a valid option and return the index.
const size_t selected_app_index =
ArcNavigationThrottle::GetAppIndex(handlers, selected_app_package);
ArcIntentPickerAppFetcher::GetAppIndex(handlers, selected_app_package);
// Make sure that the instance at least supports HandleUrl.
auto* arc_service_manager = ArcServiceManager::Get();
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.h"
#include <utility>
......@@ -49,7 +49,7 @@ size_t FindPreferredApp(
} // namespace
// static
void ArcNavigationThrottle::GetArcAppsForPicker(
void ArcIntentPickerAppFetcher::GetArcAppsForPicker(
content::WebContents* web_contents,
const GURL& url,
chromeos::GetAppsCallback callback) {
......@@ -69,13 +69,14 @@ void ArcNavigationThrottle::GetArcAppsForPicker(
return;
}
// |throttle| will delete itself when it is finished.
ArcNavigationThrottle* throttle = new ArcNavigationThrottle(web_contents);
throttle->GetArcAppsForPicker(instance, url, std::move(callback));
// |app_fetcher| will delete itself when it is finished.
ArcIntentPickerAppFetcher* app_fetcher =
new ArcIntentPickerAppFetcher(web_contents);
app_fetcher->GetArcAppsForPicker(instance, url, std::move(callback));
}
// static
bool ArcNavigationThrottle::WillGetArcAppsForNavigation(
bool ArcIntentPickerAppFetcher::WillGetArcAppsForNavigation(
content::NavigationHandle* handle,
chromeos::AppsNavigationCallback callback) {
ArcServiceManager* arc_service_manager = ArcServiceManager::Get();
......@@ -101,8 +102,9 @@ bool ArcNavigationThrottle::WillGetArcAppsForNavigation(
if (!instance)
return false;
// |throttle| will delete itself when it is finished.
ArcNavigationThrottle* throttle = new ArcNavigationThrottle(web_contents);
// |app_fetcher| will delete itself when it is finished.
ArcIntentPickerAppFetcher* app_fetcher =
new ArcIntentPickerAppFetcher(web_contents);
// Return true to defer the navigation until we asynchronously hear back from
// ARC whether a preferred app should be launched. This makes it safe to bind
......@@ -111,12 +113,12 @@ bool ArcNavigationThrottle::WillGetArcAppsForNavigation(
// prior to this asynchronous method finishing, it is safe to not run
// |callback| since it will not matter what we do with the deferred navigation
// for a now-closed tab.
throttle->GetArcAppsForNavigation(instance, url, std::move(callback));
app_fetcher->GetArcAppsForNavigation(instance, url, std::move(callback));
return true;
}
// static
bool ArcNavigationThrottle::MaybeLaunchOrPersistArcApp(
bool ArcIntentPickerAppFetcher::MaybeLaunchOrPersistArcApp(
const GURL& url,
const std::string& package_name,
bool should_launch,
......@@ -151,7 +153,7 @@ bool ArcNavigationThrottle::MaybeLaunchOrPersistArcApp(
}
// static
size_t ArcNavigationThrottle::GetAppIndex(
size_t ArcIntentPickerAppFetcher::GetAppIndex(
const std::vector<mojom::IntentHandlerInfoPtr>& app_candidates,
const std::string& selected_app_package) {
for (size_t i = 0; i < app_candidates.size(); ++i) {
......@@ -162,7 +164,7 @@ size_t ArcNavigationThrottle::GetAppIndex(
}
// static
bool ArcNavigationThrottle::IsAppAvailable(
bool ArcIntentPickerAppFetcher::IsAppAvailable(
const std::vector<mojom::IntentHandlerInfoPtr>& app_candidates) {
return app_candidates.size() > 1 ||
(app_candidates.size() == 1 &&
......@@ -171,23 +173,24 @@ bool ArcNavigationThrottle::IsAppAvailable(
}
// static
bool ArcNavigationThrottle::IsAppAvailableForTesting(
bool ArcIntentPickerAppFetcher::IsAppAvailableForTesting(
const std::vector<mojom::IntentHandlerInfoPtr>& app_candidates) {
return IsAppAvailable(app_candidates);
}
// static
size_t ArcNavigationThrottle::FindPreferredAppForTesting(
size_t ArcIntentPickerAppFetcher::FindPreferredAppForTesting(
const std::vector<mojom::IntentHandlerInfoPtr>& app_candidates) {
return FindPreferredApp(app_candidates, GURL());
}
ArcNavigationThrottle::~ArcNavigationThrottle() = default;
ArcIntentPickerAppFetcher::~ArcIntentPickerAppFetcher() = default;
ArcNavigationThrottle::ArcNavigationThrottle(content::WebContents* web_contents)
ArcIntentPickerAppFetcher::ArcIntentPickerAppFetcher(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents), weak_ptr_factory_(this) {}
void ArcNavigationThrottle::GetArcAppsForNavigation(
void ArcIntentPickerAppFetcher::GetArcAppsForNavigation(
mojom::IntentHelperInstance* instance,
const GURL& url,
chromeos::AppsNavigationCallback callback) {
......@@ -196,11 +199,11 @@ void ArcNavigationThrottle::GetArcAppsForNavigation(
instance->RequestUrlHandlerList(
url.spec(),
base::BindOnce(
&ArcNavigationThrottle::OnAppCandidatesReceivedForNavigation,
&ArcIntentPickerAppFetcher::OnAppCandidatesReceivedForNavigation,
weak_ptr_factory_.GetWeakPtr(), url, std::move(callback)));
}
void ArcNavigationThrottle::GetArcAppsForPicker(
void ArcIntentPickerAppFetcher::GetArcAppsForPicker(
mojom::IntentHelperInstance* instance,
const GURL& url,
chromeos::GetAppsCallback callback) {
......@@ -208,20 +211,21 @@ void ArcNavigationThrottle::GetArcAppsForPicker(
instance->RequestUrlHandlerList(
url.spec(),
base::BindOnce(&ArcNavigationThrottle::OnAppCandidatesReceivedForPicker,
weak_ptr_factory_.GetWeakPtr(), url, std::move(callback)));
base::BindOnce(
&ArcIntentPickerAppFetcher::OnAppCandidatesReceivedForPicker,
weak_ptr_factory_.GetWeakPtr(), url, std::move(callback)));
}
void ArcNavigationThrottle::OnAppCandidatesReceivedForNavigation(
void ArcIntentPickerAppFetcher::OnAppCandidatesReceivedForNavigation(
const GURL& url,
chromeos::AppsNavigationCallback callback,
std::vector<mojom::IntentHandlerInfoPtr> app_candidates) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::unique_ptr<ArcNavigationThrottle> deleter(this);
std::unique_ptr<ArcIntentPickerAppFetcher> deleter(this);
if (!IsAppAvailable(app_candidates)) {
// This scenario shouldn't be accessed as ArcNavigationThrottle is created
// iff there are ARC apps which can actually handle the given URL.
// This scenario shouldn't be accessed as ArcIntentPickerAppFetcher is
// created iff there are ARC apps which can actually handle the given URL.
DVLOG(1) << "There are no app candidates for this URL: " << url;
chromeos::AppsNavigationThrottle::RecordUma(
std::string(), apps::mojom::AppType::kUnknown,
......@@ -257,13 +261,13 @@ void ArcNavigationThrottle::OnAppCandidatesReceivedForNavigation(
chromeos::AppsNavigationAction::RESUME));
}
void ArcNavigationThrottle::OnAppCandidatesReceivedForPicker(
void ArcIntentPickerAppFetcher::OnAppCandidatesReceivedForPicker(
const GURL& url,
chromeos::GetAppsCallback callback,
std::vector<arc::mojom::IntentHandlerInfoPtr> app_candidates) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::unique_ptr<ArcNavigationThrottle> deleter(this);
std::unique_ptr<ArcIntentPickerAppFetcher> deleter(this);
if (!IsAppAvailable(app_candidates)) {
DVLOG(1) << "There are no app candidates for this URL";
std::move(callback).Run({});
......@@ -274,7 +278,7 @@ void ArcNavigationThrottle::OnAppCandidatesReceivedForPicker(
GetArcAppIcons(url, std::move(app_candidates), std::move(callback));
}
chromeos::PreferredPlatform ArcNavigationThrottle::DidLaunchPreferredArcApp(
chromeos::PreferredPlatform ArcIntentPickerAppFetcher::DidLaunchPreferredArcApp(
const GURL& url,
const std::vector<mojom::IntentHandlerInfoPtr>& app_candidates) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
......@@ -316,11 +320,11 @@ chromeos::PreferredPlatform ArcNavigationThrottle::DidLaunchPreferredArcApp(
return preferred_platform;
}
void ArcNavigationThrottle::GetArcAppIcons(
void ArcIntentPickerAppFetcher::GetArcAppIcons(
const GURL& url,
std::vector<mojom::IntentHandlerInfoPtr> app_candidates,
chromeos::GetAppsCallback callback) {
std::unique_ptr<ArcNavigationThrottle> deleter(this);
std::unique_ptr<ArcIntentPickerAppFetcher> deleter(this);
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
auto* intent_helper_bridge = ArcIntentHelperBridge::GetForBrowserContext(
......@@ -340,19 +344,19 @@ void ArcNavigationThrottle::GetArcAppIcons(
deleter.release();
intent_helper_bridge->GetActivityIcons(
activities,
base::BindOnce(&ArcNavigationThrottle::OnAppIconsReceived,
base::BindOnce(&ArcIntentPickerAppFetcher::OnAppIconsReceived,
weak_ptr_factory_.GetWeakPtr(), url,
std::move(app_candidates), std::move(callback)));
}
void ArcNavigationThrottle::OnAppIconsReceived(
void ArcIntentPickerAppFetcher::OnAppIconsReceived(
const GURL& url,
std::vector<arc::mojom::IntentHandlerInfoPtr> app_candidates,
chromeos::GetAppsCallback callback,
std::unique_ptr<arc::ArcIntentHelperBridge::ActivityToIconsMap> icons) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::unique_ptr<ArcNavigationThrottle> deleter(this);
std::unique_ptr<ArcIntentPickerAppFetcher> deleter(this);
std::vector<chromeos::IntentPickerAppInfo> app_info;
for (const auto& candidate : app_candidates) {
......@@ -371,7 +375,7 @@ void ArcNavigationThrottle::OnAppIconsReceived(
std::move(callback).Run(std::move(app_info));
}
void ArcNavigationThrottle::WebContentsDestroyed() {
void ArcIntentPickerAppFetcher::WebContentsDestroyed() {
delete this;
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_
#define CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_
#ifndef CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_INTENT_PICKER_APP_FETCHER_H_
#define CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_INTENT_PICKER_APP_FETCHER_H_
#include <memory>
#include <string>
......@@ -26,7 +26,7 @@ namespace arc {
// A class that allow us to retrieve installed ARC apps which can handle
// a particular URL.
class ArcNavigationThrottle : content::WebContentsObserver {
class ArcIntentPickerAppFetcher : content::WebContentsObserver {
public:
// Retrieves ARC apps which can handle |url| for |web_contents|, and runs
// |callback| when complete. Does not attempt to open preferred apps.
......@@ -70,10 +70,10 @@ class ArcNavigationThrottle : content::WebContentsObserver {
static size_t FindPreferredAppForTesting(
const std::vector<mojom::IntentHandlerInfoPtr>& app_candidates);
~ArcNavigationThrottle() override;
~ArcIntentPickerAppFetcher() override;
private:
explicit ArcNavigationThrottle(content::WebContents* web_contents);
explicit ArcIntentPickerAppFetcher(content::WebContents* web_contents);
// Asychronously queries ARC for apps which can handle |url|. Runs |callback|
// with RESUME/CANCEL for the deferred navigation and (if applicable) the list
......@@ -130,11 +130,11 @@ class ArcNavigationThrottle : content::WebContentsObserver {
void WebContentsDestroyed() override;
// This has to be the last member of the class.
base::WeakPtrFactory<ArcNavigationThrottle> weak_ptr_factory_;
base::WeakPtrFactory<ArcIntentPickerAppFetcher> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(ArcNavigationThrottle);
DISALLOW_COPY_AND_ASSIGN(ArcIntentPickerAppFetcher);
};
} // namespace arc
#endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_NAVIGATION_THROTTLE_H_
#endif // CHROME_BROWSER_CHROMEOS_ARC_INTENT_HELPER_ARC_INTENT_PICKER_APP_FETCHER_H_
......@@ -4,7 +4,7 @@
#include <utility>
#include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -34,70 +34,71 @@ std::vector<mojom::IntentHandlerInfoPtr> CreateArray(size_t num_elements,
} // namespace
TEST(ArcNavigationThrottleTest, TestIsAppAvailable) {
TEST(ArcIntentPickerAppFetcherTest, TestIsAppAvailable) {
// Test an empty array.
EXPECT_FALSE(
ArcNavigationThrottle::IsAppAvailableForTesting(CreateArray(0, 0)));
ArcIntentPickerAppFetcher::IsAppAvailableForTesting(CreateArray(0, 0)));
// Chrome only.
EXPECT_FALSE(
ArcNavigationThrottle::IsAppAvailableForTesting(CreateArray(1, 0)));
ArcIntentPickerAppFetcher::IsAppAvailableForTesting(CreateArray(1, 0)));
// Chrome and another app.
EXPECT_TRUE(
ArcNavigationThrottle::IsAppAvailableForTesting(CreateArray(2, 0)));
ArcIntentPickerAppFetcher::IsAppAvailableForTesting(CreateArray(2, 0)));
EXPECT_TRUE(
ArcNavigationThrottle::IsAppAvailableForTesting(CreateArray(2, 1)));
ArcIntentPickerAppFetcher::IsAppAvailableForTesting(CreateArray(2, 1)));
// App(s) only. This doesn't happen on production though.
EXPECT_TRUE(
ArcNavigationThrottle::IsAppAvailableForTesting(CreateArray(1, 1)));
ArcIntentPickerAppFetcher::IsAppAvailableForTesting(CreateArray(1, 1)));
EXPECT_TRUE(
ArcNavigationThrottle::IsAppAvailableForTesting(CreateArray(2, 2)));
ArcIntentPickerAppFetcher::IsAppAvailableForTesting(CreateArray(2, 2)));
}
TEST(ArcNavigationThrottleTest, TestFindPreferredApp) {
TEST(ArcIntentPickerAppFetcherTest, TestFindPreferredApp) {
// Test an empty array.
EXPECT_EQ(
0u, ArcNavigationThrottle::FindPreferredAppForTesting(CreateArray(0, 0)));
EXPECT_EQ(0u, ArcIntentPickerAppFetcher::FindPreferredAppForTesting(
CreateArray(0, 0)));
// Test no-preferred-app cases.
EXPECT_EQ(
1u, ArcNavigationThrottle::FindPreferredAppForTesting(CreateArray(1, 0)));
EXPECT_EQ(
2u, ArcNavigationThrottle::FindPreferredAppForTesting(CreateArray(2, 1)));
EXPECT_EQ(
3u, ArcNavigationThrottle::FindPreferredAppForTesting(CreateArray(3, 2)));
EXPECT_EQ(1u, ArcIntentPickerAppFetcher::FindPreferredAppForTesting(
CreateArray(1, 0)));
EXPECT_EQ(2u, ArcIntentPickerAppFetcher::FindPreferredAppForTesting(
CreateArray(2, 1)));
EXPECT_EQ(3u, ArcIntentPickerAppFetcher::FindPreferredAppForTesting(
CreateArray(3, 2)));
// Add a preferred app and call the function.
for (size_t i = 0; i < 3; ++i) {
std::vector<mojom::IntentHandlerInfoPtr> handlers = CreateArray(3, 0);
handlers[i]->is_preferred = true;
EXPECT_EQ(i, ArcNavigationThrottle::FindPreferredAppForTesting(handlers))
EXPECT_EQ(i,
ArcIntentPickerAppFetcher::FindPreferredAppForTesting(handlers))
<< i;
}
}
TEST(ArcNavigationThrottleTest, TestGetAppIndex) {
TEST(ArcIntentPickerAppFetcherTest, TestGetAppIndex) {
const std::string package_name =
ArcIntentHelperBridge::kArcIntentHelperPackageName;
// Test an empty array.
EXPECT_EQ(
0u, ArcNavigationThrottle::GetAppIndex(CreateArray(0, 0), package_name));
EXPECT_EQ(0u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(0, 0),
package_name));
// Test Chrome-only case.
EXPECT_EQ(
0u, ArcNavigationThrottle::GetAppIndex(CreateArray(1, 0), package_name));
EXPECT_EQ(0u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(1, 0),
package_name));
// Test not-found cases.
EXPECT_EQ(
1u, ArcNavigationThrottle::GetAppIndex(CreateArray(1, 1), package_name));
EXPECT_EQ(
2u, ArcNavigationThrottle::GetAppIndex(CreateArray(2, 2), package_name));
EXPECT_EQ(1u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(1, 1),
package_name));
EXPECT_EQ(2u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(2, 2),
package_name));
// Test other cases.
EXPECT_EQ(
0u, ArcNavigationThrottle::GetAppIndex(CreateArray(2, 0), package_name));
EXPECT_EQ(
1u, ArcNavigationThrottle::GetAppIndex(CreateArray(2, 1), package_name));
EXPECT_EQ(
0u, ArcNavigationThrottle::GetAppIndex(CreateArray(3, 0), package_name));
EXPECT_EQ(
1u, ArcNavigationThrottle::GetAppIndex(CreateArray(3, 1), package_name));
EXPECT_EQ(
2u, ArcNavigationThrottle::GetAppIndex(CreateArray(3, 2), package_name));
EXPECT_EQ(0u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(2, 0),
package_name));
EXPECT_EQ(1u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(2, 1),
package_name));
EXPECT_EQ(0u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(3, 0),
package_name));
EXPECT_EQ(1u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(3, 1),
package_name));
EXPECT_EQ(2u, ArcIntentPickerAppFetcher::GetAppIndex(CreateArray(3, 2),
package_name));
}
} // namespace arc
......@@ -11,7 +11,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "chrome/browser/chromeos/apps/intent_helper/apps_navigation_types.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
#include "content/public/browser/web_contents.h"
......
......@@ -30,7 +30,7 @@
#include "ui/views/view.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/arc/intent_helper/arc_navigation_throttle.h"
#include "chrome/browser/chromeos/arc/intent_helper/arc_intent_picker_app_fetcher.h"
#include "chrome/browser/ui/views/intent_picker_bubble_view.h"
#include "components/arc/common/intent_helper.mojom.h" // nogncheck https://crbug.com/784179
#include "components/arc/intent_helper/arc_intent_helper_bridge.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment