android_intent_helper_unittest.cc 869 B

123456789101112131415161718192021222324252627
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/public/cpp/android_intent_helper.h"
  5. #include "testing/gtest/include/gtest/gtest.h"
  6. namespace ash {
  7. using AndroidIntentHelperTest = testing::Test;
  8. TEST_F(AndroidIntentHelperTest, AndroidIntentURL) {
  9. const std::string intent_url_type_1 = "intent://abc";
  10. EXPECT_TRUE(IsAndroidIntent(GURL(intent_url_type_1)));
  11. const std::string intent_url_type_2 =
  12. "http://www.youtube.com/watch?v=abc;"
  13. "#Intent;action=android.intent.action.VIEW;"
  14. "package=com.google.android.youtube;end";
  15. EXPECT_TRUE(IsAndroidIntent(GURL(intent_url_type_2)));
  16. const std::string normal_url = "http://www.google.com";
  17. EXPECT_FALSE(IsAndroidIntent(GURL(normal_url)));
  18. }
  19. } // namespace ash