diff options
author | petewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 19:58:05 +0000 |
---|---|---|
committer | petewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 19:58:05 +0000 |
commit | 3a585276f38d07d23f84d7664791c58d58c60b29 (patch) | |
tree | 5d52a67ca0bb582af6143abffaa60ac7a8ea2ab9 /chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h | |
parent | 0e01c0207a24c425287dee4bf77dbf7478140a41 (diff) | |
download | chromium_src-3a585276f38d07d23f84d7664791c58d58c60b29.zip chromium_src-3a585276f38d07d23f84d7664791c58d58c60b29.tar.gz chromium_src-3a585276f38d07d23f84d7664791c58d58c60b29.tar.bz2 |
Add implementation and tests for clicking on a notification.
To round out the feature of clicking on the body of a notification or on a
text button, we should navigate to the appropriate URL for the background
or button. This change adds code to do that, and the proper browser tests.
This change also refactors the button code to be able to accept an arbitrary
number of buttons from the synced notification. Note that Rich Notifications
is still limited to two buttons, though, so only two buttons are passed to Rich
Notifications.
This change also includes a refactoring to return GURL everywhere we have a
URL instead of returning a string.
BUG=247564
Review URL: https://chromiumcodereview.appspot.com/17450021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h')
-rw-r--r-- | chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h b/chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h new file mode 100644 index 0000000..be33257 --- /dev/null +++ b/chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h @@ -0,0 +1,97 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H_ +#define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H_ + +#include <string> + +#include "base/basictypes.h" +#include "sync/api/sync_data.h" +#include "sync/protocol/sync.pb.h" +#include "sync/protocol/synced_notification_specifics.pb.h" + + +// Fake data for creating a SyncedNotification. +extern const char kAppId1[]; +extern const char kAppId2[]; +extern const char kAppId3[]; +extern const char kAppId4[]; +extern const char kAppId5[]; +extern const char kAppId6[]; +extern const char kAppId7[]; +extern const char kKey1[]; +extern const char kKey2[]; +extern const char kKey3[]; +extern const char kKey4[]; +extern const char kKey5[]; +extern const char kKey6[]; +extern const char kKey7[]; +extern const char kIconUrl1[]; +extern const char kIconUrl2[]; +extern const char kIconUrl3[]; +extern const char kIconUrl4[]; +extern const char kIconUrl5[]; +extern const char kIconUrl6[]; +extern const char kIconUrl7[]; +extern const char kTitle1[]; +extern const char kTitle2[]; +extern const char kTitle3[]; +extern const char kTitle4[]; +extern const char kTitle5[]; +extern const char kTitle6[]; +extern const char kTitle7[]; +extern const char kText1[]; +extern const char kText2[]; +extern const char kText3[]; +extern const char kText4[]; +extern const char kText5[]; +extern const char kText6[]; +extern const char kText7[]; +extern const char kImageUrl1[]; +extern const char kImageUrl2[]; +extern const char kImageUrl3[]; +extern const char kImageUrl4[]; +extern const char kImageUrl5[]; +extern const char kImageUrl6[]; +extern const char kImageUrl7[]; +extern const char kExpectedOriginUrl[]; +extern const char kDefaultDestinationTitle[]; +extern const char kDefaultDestinationIconUrl[]; +extern const char kDefaultDestinationUrl[]; +extern const char kButtonOneTitle[]; +extern const char kButtonOneIconUrl[]; +extern const char kButtonOneUrl[]; +extern const char kButtonTwoTitle[]; +extern const char kButtonTwoIconUrl[]; +extern const char kButtonTwoUrl[]; +extern const char kContainedTitle1[]; +extern const char kContainedTitle2[]; +extern const char kContainedTitle3[]; +extern const char kContainedMessage1[]; +extern const char kContainedMessage2[]; +extern const char kContainedMessage3[]; +const uint64 kFakeCreationTime = 42; +const int kProtobufPriority = static_cast<int>( + sync_pb::CoalescedSyncedNotification_Priority_LOW); + +const sync_pb::CoalescedSyncedNotification_ReadState kRead = + sync_pb::CoalescedSyncedNotification_ReadState_READ; +const sync_pb::CoalescedSyncedNotification_ReadState kDismissed = + sync_pb::CoalescedSyncedNotification_ReadState_DISMISSED; +const sync_pb::CoalescedSyncedNotification_ReadState kUnread = + sync_pb::CoalescedSyncedNotification_ReadState_UNREAD; + +// This function builds the sync data object we use to create a testing +// notification. +syncer::SyncData CreateSyncData( + const std::string& title, + const std::string& text, + const std::string& app_icon_url, + const std::string& image_url, + const std::string& app_id, + const std::string& key, + const sync_pb::CoalescedSyncedNotification_ReadState read_state); + +#endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H_ |