Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ios/chrome/browser/ui/activity_services/activity_service_controller.h" | 5 #import "ios/chrome/browser/ui/activity_services/activity_service_controller.h" |
| 6 | 6 |
| 7 #import <MobileCoreServices/MobileCoreServices.h> | 7 #import <MobileCoreServices/MobileCoreServices.h> |
| 8 | 8 |
| 9 #import "base/test/ios/wait_util.h" | 9 #import "base/test/ios/wait_util.h" |
| 10 #include "components/reading_list/core/reading_list_switches.h" | |
| 11 #import "ios/chrome/browser/ui/activity_services/activity_type_util.h" | 10 #import "ios/chrome/browser/ui/activity_services/activity_type_util.h" |
| 12 #import "ios/chrome/browser/ui/activity_services/appex_constants.h" | 11 #import "ios/chrome/browser/ui/activity_services/appex_constants.h" |
| 13 #import "ios/chrome/browser/ui/activity_services/chrome_activity_item_source.h" | 12 #import "ios/chrome/browser/ui/activity_services/chrome_activity_item_source.h" |
| 14 #import "ios/chrome/browser/ui/activity_services/print_activity.h" | 13 #import "ios/chrome/browser/ui/activity_services/print_activity.h" |
| 15 #import "ios/chrome/browser/ui/activity_services/share_to_data.h" | 14 #import "ios/chrome/browser/ui/activity_services/share_to_data.h" |
| 16 #include "ios/web/public/test/test_web_thread_bundle.h" | 15 #include "ios/web/public/test/test_web_thread_bundle.h" |
| 17 #include "testing/gtest_mac.h" | 16 #include "testing/gtest_mac.h" |
| 18 #include "testing/platform_test.h" | 17 #include "testing/platform_test.h" |
| 19 #import "third_party/ocmock/OCMock/OCMock.h" | 18 #import "third_party/ocmock/OCMock/OCMock.h" |
| 20 #import "third_party/ocmock/gtest_support.h" | 19 #import "third_party/ocmock/gtest_support.h" |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 // Verify printable data. | 434 // Verify printable data. |
| 436 ShareToData* data = | 435 ShareToData* data = |
| 437 [[ShareToData alloc] initWithURL:GURL("https://chromium.org/printable") | 436 [[ShareToData alloc] initWithURL:GURL("https://chromium.org/printable") |
| 438 title:@"bar" | 437 title:@"bar" |
| 439 isOriginalTitle:YES | 438 isOriginalTitle:YES |
| 440 isPagePrintable:YES | 439 isPagePrintable:YES |
| 441 thumbnailGenerator:DummyThumbnailGeneratorBlock()]; | 440 thumbnailGenerator:DummyThumbnailGeneratorBlock()]; |
| 442 | 441 |
| 443 NSArray* items = | 442 NSArray* items = |
| 444 [activityController applicationActivitiesForData:data controller:nil]; | 443 [activityController applicationActivitiesForData:data controller:nil]; |
| 445 NSUInteger expected_items_count = | 444 NSUInteger expected_items_count = 2U; |
| 446 reading_list::switches::IsReadingListEnabled() ? 2U : 1U; | |
| 447 ASSERT_EQ(expected_items_count, [items count]); | 445 ASSERT_EQ(expected_items_count, [items count]); |
|
sdefresne
2017/03/23 15:49:06
nit: can you inline the expected_items_count here
gambard
2017/03/23 15:53:16
Done.
| |
| 448 EXPECT_EQ([PrintActivity class], [[items objectAtIndex:0] class]); | 446 EXPECT_EQ([PrintActivity class], [[items objectAtIndex:0] class]); |
| 449 | 447 |
| 450 // Verify non-printable data. | 448 // Verify non-printable data. |
| 451 data = | 449 data = |
| 452 [[ShareToData alloc] initWithURL:GURL("https://chromium.org/unprintable") | 450 [[ShareToData alloc] initWithURL:GURL("https://chromium.org/unprintable") |
| 453 title:@"baz" | 451 title:@"baz" |
| 454 isOriginalTitle:YES | 452 isOriginalTitle:YES |
| 455 isPagePrintable:NO | 453 isPagePrintable:NO |
| 456 thumbnailGenerator:DummyThumbnailGeneratorBlock()]; | 454 thumbnailGenerator:DummyThumbnailGeneratorBlock()]; |
| 457 items = [activityController applicationActivitiesForData:data controller:nil]; | 455 items = [activityController applicationActivitiesForData:data controller:nil]; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 481 // public.url UTType in order to allow Share actions (e.g. Facebook, Twitter, | 479 // public.url UTType in order to allow Share actions (e.g. Facebook, Twitter, |
| 482 // etc) to appear on UIActivityViewController opened by Chrome). | 480 // etc) to appear on UIActivityViewController opened by Chrome). |
| 483 CFStringRef chromeFindLoginAction = reinterpret_cast<CFStringRef>( | 481 CFStringRef chromeFindLoginAction = reinterpret_cast<CFStringRef>( |
| 484 activity_services::kUTTypeAppExtensionFindLoginAction); | 482 activity_services::kUTTypeAppExtensionFindLoginAction); |
| 485 EXPECT_TRUE(UTTypeConformsTo(chromeFindLoginAction, kUTTypeURL)); | 483 EXPECT_TRUE(UTTypeConformsTo(chromeFindLoginAction, kUTTypeURL)); |
| 486 EXPECT_TRUE( | 484 EXPECT_TRUE( |
| 487 UTTypeConformsTo(chromeFindLoginAction, onePasswordFindLoginAction)); | 485 UTTypeConformsTo(chromeFindLoginAction, onePasswordFindLoginAction)); |
| 488 } | 486 } |
| 489 | 487 |
| 490 } // namespace | 488 } // namespace |
| OLD | NEW |