Commit af7de424 authored by Xi Cheng's avatar Xi Cheng Committed by Commit Bot

Correct object names to fake* from mock*

These objects are created to satisfy the interface requirements but
have limited and/or reduced functionality. According to naming rules,
they should be called fake*.

Change-Id: I24fcc274b730305b89a8b1c9d269793dbd448a63
Reviewed-on: https://chromium-review.googlesource.com/c/1338202Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Commit-Queue: Xi Cheng <chengx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608542}
parent bb1a4687
...@@ -5287,8 +5287,8 @@ static_library("test_support") { ...@@ -5287,8 +5287,8 @@ static_library("test_support") {
if (is_win) { if (is_win) {
sources += [ sources += [
"notifications/win/mock_itoastnotification.cc", "notifications/win/fake_itoastnotification.cc",
"notifications/win/mock_itoastnotification.h", "notifications/win/fake_itoastnotification.h",
] ]
} }
......
...@@ -56,7 +56,7 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge { ...@@ -56,7 +56,7 @@ class NotificationPlatformBridgeWin : public NotificationPlatformBridge {
FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, HandleEvent); FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, HandleEvent);
FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, HandleSettings); FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, HandleSettings);
FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest, FRIEND_TEST_ALL_PREFIXES(NotificationPlatformBridgeWinUITest,
DisplayWithMockAC); DisplayWithFakeAC);
// Simulates a click/dismiss event. Only for use in testing. // Simulates a click/dismiss event. Only for use in testing.
// Note: Ownership of |notification| and |args| is retained by the caller. // Note: Ownership of |notification| and |args| is retained by the caller.
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/notifications/notification_display_service_tester.h" #include "chrome/browser/notifications/notification_display_service_tester.h"
#include "chrome/browser/notifications/notification_platform_bridge_win.h" #include "chrome/browser/notifications/notification_platform_bridge_win.h"
#include "chrome/browser/notifications/win/mock_itoastnotification.h" #include "chrome/browser/notifications/win/fake_itoastnotification.h"
#include "chrome/browser/notifications/win/mock_itoastnotifier.h" #include "chrome/browser/notifications/win/fake_itoastnotifier.h"
#include "chrome/browser/notifications/win/notification_launch_id.h" #include "chrome/browser/notifications/win/notification_launch_id.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
...@@ -185,15 +185,15 @@ class NotificationPlatformBridgeWinUITest : public InProcessBrowserTest { ...@@ -185,15 +185,15 @@ class NotificationPlatformBridgeWinUITest : public InProcessBrowserTest {
bool delegate_called_ = false; bool delegate_called_ = false;
}; };
class MockIToastActivatedEventArgs class FakeIToastActivatedEventArgs
: public Microsoft::WRL::RuntimeClass< : public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassFlags<
Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>, Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>,
winui::Notifications::IToastActivatedEventArgs> { winui::Notifications::IToastActivatedEventArgs> {
public: public:
explicit MockIToastActivatedEventArgs(const base::string16& args) explicit FakeIToastActivatedEventArgs(const base::string16& args)
: arguments_(args) {} : arguments_(args) {}
~MockIToastActivatedEventArgs() override = default; ~FakeIToastActivatedEventArgs() override = default;
HRESULT STDMETHODCALLTYPE get_Arguments(HSTRING* value) override { HRESULT STDMETHODCALLTYPE get_Arguments(HSTRING* value) override {
base::win::ScopedHString arguments = base::win::ScopedHString arguments =
...@@ -205,7 +205,7 @@ class MockIToastActivatedEventArgs ...@@ -205,7 +205,7 @@ class MockIToastActivatedEventArgs
private: private:
base::string16 arguments_; base::string16 arguments_;
DISALLOW_COPY_AND_ASSIGN(MockIToastActivatedEventArgs); DISALLOW_COPY_AND_ASSIGN(FakeIToastActivatedEventArgs);
}; };
IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, HandleEvent) { IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, HandleEvent) {
...@@ -226,8 +226,8 @@ IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, HandleEvent) { ...@@ -226,8 +226,8 @@ IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, HandleEvent) {
</toast> </toast>
)"; )";
MockIToastNotification toast(kXmlDoc, L"tag"); FakeIToastNotification toast(kXmlDoc, L"tag");
MockIToastActivatedEventArgs args( FakeIToastActivatedEventArgs args(
L"1|1|0|Default|0|https://example.com/|notification_id"); L"1|1|0|Default|0|https://example.com/|notification_id");
base::RunLoop run_loop; base::RunLoop run_loop;
...@@ -297,8 +297,8 @@ IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, HandleSettings) { ...@@ -297,8 +297,8 @@ IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, HandleSettings) {
</toast> </toast>
)"; )";
MockIToastNotification toast(kXmlDoc, L"tag"); FakeIToastNotification toast(kXmlDoc, L"tag");
MockIToastActivatedEventArgs args( FakeIToastActivatedEventArgs args(
L"2|0|Default|0|https://example.com/|notification_id"); L"2|0|Default|0|https://example.com/|notification_id");
base::RunLoop run_loop; base::RunLoop run_loop;
...@@ -351,15 +351,15 @@ IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, GetDisplayed) { ...@@ -351,15 +351,15 @@ IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, GetDisplayed) {
bool incognito = true; bool incognito = true;
Profile* profile1 = CreateTestingProfile("P1"); Profile* profile1 = CreateTestingProfile("P1");
notifications.push_back(Microsoft::WRL::Make<MockIToastNotification>( notifications.push_back(Microsoft::WRL::Make<FakeIToastNotification>(
GetToastString(L"P1i", L"P1", incognito), L"tag")); GetToastString(L"P1i", L"P1", incognito), L"tag"));
notifications.push_back(Microsoft::WRL::Make<MockIToastNotification>( notifications.push_back(Microsoft::WRL::Make<FakeIToastNotification>(
GetToastString(L"P1reg", L"P1", !incognito), L"tag")); GetToastString(L"P1reg", L"P1", !incognito), L"tag"));
Profile* profile2 = CreateTestingProfile("P2"); Profile* profile2 = CreateTestingProfile("P2");
notifications.push_back(Microsoft::WRL::Make<MockIToastNotification>( notifications.push_back(Microsoft::WRL::Make<FakeIToastNotification>(
GetToastString(L"P2i", L"P2", incognito), L"tag")); GetToastString(L"P2i", L"P2", incognito), L"tag"));
notifications.push_back(Microsoft::WRL::Make<MockIToastNotification>( notifications.push_back(Microsoft::WRL::Make<FakeIToastNotification>(
GetToastString(L"P2reg", L"P2", !incognito), L"tag")); GetToastString(L"P2reg", L"P2", !incognito), L"tag"));
// Query for profile P1 in incognito (should return 1 item). // Query for profile P1 in incognito (should return 1 item).
...@@ -417,16 +417,16 @@ IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, GetDisplayed) { ...@@ -417,16 +417,16 @@ IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, GetDisplayed) {
bridge->SetDisplayedNotificationsForTesting(nullptr); bridge->SetDisplayedNotificationsForTesting(nullptr);
} }
// Test calling Display with a mock implementation of the Action Center // Test calling Display with a fake implementation of the Action Center
// and validate it gets the values expected. // and validate it gets the values expected.
IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, DisplayWithMockAC) { IN_PROC_BROWSER_TEST_F(NotificationPlatformBridgeWinUITest, DisplayWithFakeAC) {
if (base::win::GetVersion() < kMinimumWindowsVersion) if (base::win::GetVersion() < kMinimumWindowsVersion)
return; return;
NotificationPlatformBridgeWin* bridge = GetBridge(); NotificationPlatformBridgeWin* bridge = GetBridge();
ASSERT_TRUE(bridge); ASSERT_TRUE(bridge);
MockIToastNotifier notifier; FakeIToastNotifier notifier;
bridge->SetNotifierForTesting(&notifier); bridge->SetNotifierForTesting(&notifier);
std::string launch_id_value = "0|0|P1|0|https://example.com/|notification_id"; std::string launch_id_value = "0|0|P1|0|https://example.com/|notification_id";
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include "base/win/scoped_hstring.h" #include "base/win/scoped_hstring.h"
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "chrome/browser/notifications/notification_common.h" #include "chrome/browser/notifications/notification_common.h"
#include "chrome/browser/notifications/win/mock_itoastnotification.h" #include "chrome/browser/notifications/win/fake_itoastnotification.h"
#include "chrome/browser/notifications/win/mock_notification_image_retainer.h" #include "chrome/browser/notifications/win/fake_notification_image_retainer.h"
#include "chrome/browser/notifications/win/notification_launch_id.h" #include "chrome/browser/notifications/win/notification_launch_id.h"
#include "chrome/browser/notifications/win/notification_template_builder.h" #include "chrome/browser/notifications/win/notification_template_builder.h"
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
...@@ -72,7 +72,7 @@ class NotificationPlatformBridgeWinTest : public testing::Test { ...@@ -72,7 +72,7 @@ class NotificationPlatformBridgeWinTest : public testing::Test {
message_center::NotifierId(origin), message_center::NotifierId(origin),
message_center::RichNotificationData(), nullptr /* delegate */); message_center::RichNotificationData(), nullptr /* delegate */);
notification->set_renotify(renotify); notification->set_renotify(renotify);
MockNotificationImageRetainer image_retainer; FakeNotificationImageRetainer image_retainer;
base::string16 xml_template = base::string16 xml_template =
BuildNotificationTemplate(&image_retainer, launch_id, *notification); BuildNotificationTemplate(&image_retainer, launch_id, *notification);
...@@ -244,9 +244,9 @@ TEST_F(NotificationPlatformBridgeWinTest, Suppress) { ...@@ -244,9 +244,9 @@ TEST_F(NotificationPlatformBridgeWinTest, Suppress) {
// Register a single notification with a specific tag. // Register a single notification with a specific tag.
std::string tag_data = std::string(kNotificationId) + "|" + kProfileId + "|0"; std::string tag_data = std::string(kNotificationId) + "|" + kProfileId + "|0";
base::string16 tag = base::UintToString16(base::Hash(tag_data)); base::string16 tag = base::UintToString16(base::Hash(tag_data));
// Microsoft::WRL::Make() requires MockIToastNotification to derive from // Microsoft::WRL::Make() requires FakeIToastNotification to derive from
// RuntimeClass. // RuntimeClass.
notifications.push_back(Microsoft::WRL::Make<MockIToastNotification>( notifications.push_back(Microsoft::WRL::Make<FakeIToastNotification>(
L"<toast launch=\"0|0|Default|0|https://foo.com/|id\"></toast>", tag)); L"<toast launch=\"0|0|Default|0|https://foo.com/|id\"></toast>", tag));
// Request this notification with renotify true (should not be suppressed). // Request this notification with renotify true (should not be suppressed).
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/notifications/win/mock_itoastnotification.h" #include "chrome/browser/notifications/win/fake_itoastnotification.h"
#include <wrl/client.h> #include <wrl/client.h>
...@@ -13,11 +13,11 @@ namespace mswr = Microsoft::WRL; ...@@ -13,11 +13,11 @@ namespace mswr = Microsoft::WRL;
namespace winui = ABI::Windows::UI; namespace winui = ABI::Windows::UI;
namespace winxml = ABI::Windows::Data::Xml; namespace winxml = ABI::Windows::Data::Xml;
MockIToastNotification::MockIToastNotification(const base::string16& xml, FakeIToastNotification::FakeIToastNotification(const base::string16& xml,
const base::string16& tag) const base::string16& tag)
: xml_(xml), group_(L"Notifications"), tag_(tag) {} : xml_(xml), group_(L"Notifications"), tag_(tag) {}
HRESULT MockIToastNotification::get_Content(winxml::Dom::IXmlDocument** value) { HRESULT FakeIToastNotification::get_Content(winxml::Dom::IXmlDocument** value) {
mswr::ComPtr<winxml::Dom::IXmlDocumentIO> xml_document_io; mswr::ComPtr<winxml::Dom::IXmlDocumentIO> xml_document_io;
base::win::ScopedHString id = base::win::ScopedHString::Create( base::win::ScopedHString id = base::win::ScopedHString::Create(
RuntimeClass_Windows_Data_Xml_Dom_XmlDocument); RuntimeClass_Windows_Data_Xml_Dom_XmlDocument);
...@@ -46,75 +46,75 @@ HRESULT MockIToastNotification::get_Content(winxml::Dom::IXmlDocument** value) { ...@@ -46,75 +46,75 @@ HRESULT MockIToastNotification::get_Content(winxml::Dom::IXmlDocument** value) {
return S_OK; return S_OK;
} }
HRESULT MockIToastNotification::put_ExpirationTime( HRESULT FakeIToastNotification::put_ExpirationTime(
__FIReference_1_Windows__CFoundation__CDateTime* value) { __FIReference_1_Windows__CFoundation__CDateTime* value) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::get_ExpirationTime( HRESULT FakeIToastNotification::get_ExpirationTime(
__FIReference_1_Windows__CFoundation__CDateTime** value) { __FIReference_1_Windows__CFoundation__CDateTime** value) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::add_Dismissed( HRESULT FakeIToastNotification::add_Dismissed(
__FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_Windows__CUI__CNotifications__CToastDismissedEventArgs* __FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_Windows__CUI__CNotifications__CToastDismissedEventArgs*
handler, handler,
EventRegistrationToken* cookie) { EventRegistrationToken* cookie) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::remove_Dismissed( HRESULT FakeIToastNotification::remove_Dismissed(
EventRegistrationToken cookie) { EventRegistrationToken cookie) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::add_Activated( HRESULT FakeIToastNotification::add_Activated(
__FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_IInspectable* __FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_IInspectable*
handler, handler,
EventRegistrationToken* cookie) { EventRegistrationToken* cookie) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::remove_Activated( HRESULT FakeIToastNotification::remove_Activated(
EventRegistrationToken cookie) { EventRegistrationToken cookie) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::add_Failed( HRESULT FakeIToastNotification::add_Failed(
__FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_Windows__CUI__CNotifications__CToastFailedEventArgs* __FITypedEventHandler_2_Windows__CUI__CNotifications__CToastNotification_Windows__CUI__CNotifications__CToastFailedEventArgs*
handler, handler,
EventRegistrationToken* token) { EventRegistrationToken* token) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::remove_Failed(EventRegistrationToken token) { HRESULT FakeIToastNotification::remove_Failed(EventRegistrationToken token) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::put_Tag(HSTRING value) { HRESULT FakeIToastNotification::put_Tag(HSTRING value) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::get_Tag(HSTRING* value) { HRESULT FakeIToastNotification::get_Tag(HSTRING* value) {
base::win::ScopedHString tag = base::win::ScopedHString::Create(tag_); base::win::ScopedHString tag = base::win::ScopedHString::Create(tag_);
*value = tag.release(); *value = tag.release();
return S_OK; return S_OK;
} }
HRESULT MockIToastNotification::put_Group(HSTRING value) { HRESULT FakeIToastNotification::put_Group(HSTRING value) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::get_Group(HSTRING* value) { HRESULT FakeIToastNotification::get_Group(HSTRING* value) {
base::win::ScopedHString group = base::win::ScopedHString::Create(group_); base::win::ScopedHString group = base::win::ScopedHString::Create(group_);
*value = group.release(); *value = group.release();
return S_OK; return S_OK;
} }
HRESULT MockIToastNotification::put_SuppressPopup(boolean value) { HRESULT FakeIToastNotification::put_SuppressPopup(boolean value) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotification::get_SuppressPopup(boolean* value) { HRESULT FakeIToastNotification::get_SuppressPopup(boolean* value) {
return E_NOTIMPL; return E_NOTIMPL;
} }
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_ITOASTNOTIFICATION_H_ #ifndef CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_ITOASTNOTIFICATION_H_
#define CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_ITOASTNOTIFICATION_H_ #define CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_ITOASTNOTIFICATION_H_
#include <windows.ui.notifications.h> #include <windows.ui.notifications.h>
#include <wrl/implements.h> #include <wrl/implements.h>
...@@ -11,16 +11,16 @@ ...@@ -11,16 +11,16 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
class MockIToastNotification class FakeIToastNotification
: public Microsoft::WRL::RuntimeClass< : public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassFlags<
Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>, Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>,
ABI::Windows::UI::Notifications::IToastNotification, ABI::Windows::UI::Notifications::IToastNotification,
ABI::Windows::UI::Notifications::IToastNotification2> { ABI::Windows::UI::Notifications::IToastNotification2> {
public: public:
explicit MockIToastNotification(const base::string16& xml, explicit FakeIToastNotification(const base::string16& xml,
const base::string16& tag); const base::string16& tag);
~MockIToastNotification() override = default; ~FakeIToastNotification() override = default;
// ABI::Windows::UI::Notifications::IToastNotification implementation: // ABI::Windows::UI::Notifications::IToastNotification implementation:
HRESULT STDMETHODCALLTYPE HRESULT STDMETHODCALLTYPE
...@@ -62,7 +62,7 @@ class MockIToastNotification ...@@ -62,7 +62,7 @@ class MockIToastNotification
base::string16 group_; base::string16 group_;
base::string16 tag_; base::string16 tag_;
DISALLOW_COPY_AND_ASSIGN(MockIToastNotification); DISALLOW_COPY_AND_ASSIGN(FakeIToastNotification);
}; };
#endif // CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_ITOASTNOTIFICATION_H_ #endif // CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_ITOASTNOTIFICATION_H_
...@@ -2,51 +2,51 @@ ...@@ -2,51 +2,51 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/notifications/win/mock_itoastnotifier.h" #include "chrome/browser/notifications/win/fake_itoastnotifier.h"
#include "chrome/browser/notifications/win/notification_launch_id.h" #include "chrome/browser/notifications/win/notification_launch_id.h"
#include "chrome/browser/notifications/win/notification_util.h" #include "chrome/browser/notifications/win/notification_util.h"
namespace winui = ABI::Windows::UI; namespace winui = ABI::Windows::UI;
MockIToastNotifier::MockIToastNotifier() = default; FakeIToastNotifier::FakeIToastNotifier() = default;
MockIToastNotifier::~MockIToastNotifier() = default; FakeIToastNotifier::~FakeIToastNotifier() = default;
void MockIToastNotifier::SetNotificationShownCallback( void FakeIToastNotifier::SetNotificationShownCallback(
const base::RepeatingCallback<void(const NotificationLaunchId& launch_id)>& const base::RepeatingCallback<void(const NotificationLaunchId& launch_id)>&
callback) { callback) {
notification_shown_callback_ = callback; notification_shown_callback_ = callback;
} }
HRESULT MockIToastNotifier::Show( HRESULT FakeIToastNotifier::Show(
winui::Notifications::IToastNotification* notification) { winui::Notifications::IToastNotification* notification) {
NotificationLaunchId launch_id = GetNotificationLaunchId(notification); NotificationLaunchId launch_id = GetNotificationLaunchId(notification);
notification_shown_callback_.Run(launch_id); notification_shown_callback_.Run(launch_id);
return S_OK; return S_OK;
} }
HRESULT MockIToastNotifier::Hide( HRESULT FakeIToastNotifier::Hide(
winui::Notifications::IToastNotification* notification) { winui::Notifications::IToastNotification* notification) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotifier::get_Setting( HRESULT FakeIToastNotifier::get_Setting(
winui::Notifications::NotificationSetting* value) { winui::Notifications::NotificationSetting* value) {
*value = winui::Notifications::NotificationSetting_Enabled; *value = winui::Notifications::NotificationSetting_Enabled;
return S_OK; return S_OK;
} }
HRESULT MockIToastNotifier::AddToSchedule( HRESULT FakeIToastNotifier::AddToSchedule(
winui::Notifications::IScheduledToastNotification* scheduledToast) { winui::Notifications::IScheduledToastNotification* scheduledToast) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotifier::RemoveFromSchedule( HRESULT FakeIToastNotifier::RemoveFromSchedule(
winui::Notifications::IScheduledToastNotification* scheduledToast) { winui::Notifications::IScheduledToastNotification* scheduledToast) {
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT MockIToastNotifier::GetScheduledToastNotifications( HRESULT FakeIToastNotifier::GetScheduledToastNotifications(
__FIVectorView_1_Windows__CUI__CNotifications__CScheduledToastNotification** __FIVectorView_1_Windows__CUI__CNotifications__CScheduledToastNotification**
scheduledToasts) { scheduledToasts) {
return E_NOTIMPL; return E_NOTIMPL;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_ITOASTNOTIFIER_H_ #ifndef CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_ITOASTNOTIFIER_H_
#define CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_ITOASTNOTIFIER_H_ #define CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_ITOASTNOTIFIER_H_
#include <windows.ui.notifications.h> #include <windows.ui.notifications.h>
#include <wrl/implements.h> #include <wrl/implements.h>
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
class NotificationLaunchId; class NotificationLaunchId;
class MockIToastNotifier class FakeIToastNotifier
: public Microsoft::WRL::RuntimeClass< : public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags< Microsoft::WRL::RuntimeClassFlags<
Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>, Microsoft::WRL::WinRt | Microsoft::WRL::InhibitRoOriginateError>,
ABI::Windows::UI::Notifications::IToastNotifier> { ABI::Windows::UI::Notifications::IToastNotifier> {
public: public:
MockIToastNotifier(); FakeIToastNotifier();
~MockIToastNotifier() override; ~FakeIToastNotifier() override;
// Sets a callback to be notified when Show has been called. // Sets a callback to be notified when Show has been called.
void SetNotificationShownCallback( void SetNotificationShownCallback(
...@@ -55,7 +55,7 @@ class MockIToastNotifier ...@@ -55,7 +55,7 @@ class MockIToastNotifier
base::RepeatingCallback<void(const NotificationLaunchId& launch_id)> base::RepeatingCallback<void(const NotificationLaunchId& launch_id)>
notification_shown_callback_; notification_shown_callback_;
DISALLOW_COPY_AND_ASSIGN(MockIToastNotifier); DISALLOW_COPY_AND_ASSIGN(FakeIToastNotifier);
}; };
#endif // CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_ITOASTNOTIFIER_H_ #endif // CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_ITOASTNOTIFIER_H_
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/notifications/win/mock_notification_image_retainer.h" #include "chrome/browser/notifications/win/fake_notification_image_retainer.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
void MockNotificationImageRetainer::CleanupFilesFromPrevSessions() {} void FakeNotificationImageRetainer::CleanupFilesFromPrevSessions() {}
base::FilePath MockNotificationImageRetainer::RegisterTemporaryImage( base::FilePath FakeNotificationImageRetainer::RegisterTemporaryImage(
const gfx::Image& image) { const gfx::Image& image) {
base::string16 file = base::string16(L"c:\\temp\\img") + base::string16 file = base::string16(L"c:\\temp\\img") +
base::IntToString16(counter_++) + base::IntToString16(counter_++) +
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_NOTIFICATION_IMAGE_RETAINER_H_ #ifndef CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_NOTIFICATION_IMAGE_RETAINER_H_
#define CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_NOTIFICATION_IMAGE_RETAINER_H_ #define CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_NOTIFICATION_IMAGE_RETAINER_H_
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/notifications/win/notification_image_retainer.h" #include "chrome/browser/notifications/win/notification_image_retainer.h"
...@@ -12,12 +12,12 @@ namespace gfx { ...@@ -12,12 +12,12 @@ namespace gfx {
class Image; class Image;
} // namespace gfx } // namespace gfx
// A mock NotificationImageRetainer class for use with unit tests. Returns // A fake NotificationImageRetainer class for use with unit tests. Returns
// predictable paths to callers wanting to register temporary files. // predictable paths to callers wanting to register temporary files.
class MockNotificationImageRetainer : public NotificationImageRetainer { class FakeNotificationImageRetainer : public NotificationImageRetainer {
public: public:
MockNotificationImageRetainer() : NotificationImageRetainer() {} FakeNotificationImageRetainer() : NotificationImageRetainer() {}
~MockNotificationImageRetainer() override = default; ~FakeNotificationImageRetainer() override = default;
// NotificationImageRetainer implementation: // NotificationImageRetainer implementation:
void CleanupFilesFromPrevSessions() override; void CleanupFilesFromPrevSessions() override;
...@@ -26,7 +26,7 @@ class MockNotificationImageRetainer : public NotificationImageRetainer { ...@@ -26,7 +26,7 @@ class MockNotificationImageRetainer : public NotificationImageRetainer {
private: private:
int counter_ = 0; int counter_ = 0;
DISALLOW_COPY_AND_ASSIGN(MockNotificationImageRetainer); DISALLOW_COPY_AND_ASSIGN(FakeNotificationImageRetainer);
}; };
#endif // CHROME_BROWSER_NOTIFICATIONS_WIN_MOCK_NOTIFICATION_IMAGE_RETAINER_H_ #endif // CHROME_BROWSER_NOTIFICATIONS_WIN_FAKE_NOTIFICATION_IMAGE_RETAINER_H_
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_task_environment.h" #include "base/test/scoped_task_environment.h"
#include "chrome/browser/notifications/win/mock_notification_image_retainer.h" #include "chrome/browser/notifications/win/fake_notification_image_retainer.h"
#include "chrome/browser/notifications/win/notification_launch_id.h" #include "chrome/browser/notifications/win/notification_launch_id.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -78,7 +78,7 @@ class NotificationTemplateBuilderTest : public ::testing::Test { ...@@ -78,7 +78,7 @@ class NotificationTemplateBuilderTest : public ::testing::Test {
// must be wrapped in ASSERT_NO_FATAL_FAILURE(). // must be wrapped in ASSERT_NO_FATAL_FAILURE().
void VerifyXml(const message_center::Notification& notification, void VerifyXml(const message_center::Notification& notification,
const base::string16& expected_xml_template) { const base::string16& expected_xml_template) {
MockNotificationImageRetainer image_retainer; FakeNotificationImageRetainer image_retainer;
NotificationLaunchId launch_id(kEncodedId); NotificationLaunchId launch_id(kEncodedId);
base::string16 xml_template = base::string16 xml_template =
BuildNotificationTemplate(&image_retainer, launch_id, notification); BuildNotificationTemplate(&image_retainer, launch_id, notification);
......
...@@ -2806,8 +2806,8 @@ test("unit_tests") { ...@@ -2806,8 +2806,8 @@ test("unit_tests") {
if (is_win) { if (is_win) {
assert(toolkit_views) assert(toolkit_views)
sources += [ sources += [
"../browser/notifications/win/mock_notification_image_retainer.cc", "../browser/notifications/win/fake_notification_image_retainer.cc",
"../browser/notifications/win/mock_notification_image_retainer.h", "../browser/notifications/win/fake_notification_image_retainer.h",
"../browser/ui/views/try_chrome_dialog_win/button_layout_unittest.cc", "../browser/ui/views/try_chrome_dialog_win/button_layout_unittest.cc",
] ]
if (enable_widevine) { if (enable_widevine) {
...@@ -5012,8 +5012,8 @@ if (!is_android) { ...@@ -5012,8 +5012,8 @@ if (!is_android) {
sources += [ sources += [
"../browser/downgrade/user_data_downgrade_browsertest.cc", "../browser/downgrade/user_data_downgrade_browsertest.cc",
"../browser/notifications/notification_platform_bridge_win_interactive_uitest.cc", "../browser/notifications/notification_platform_bridge_win_interactive_uitest.cc",
"../browser/notifications/win/mock_itoastnotifier.cc", "../browser/notifications/win/fake_itoastnotifier.cc",
"../browser/notifications/win/mock_itoastnotifier.h", "../browser/notifications/win/fake_itoastnotifier.h",
"../browser/ui/views/touch_events_interactive_uitest_win.cc", "../browser/ui/views/touch_events_interactive_uitest_win.cc",
"//ui/resources/cursors/aliasb.cur", "//ui/resources/cursors/aliasb.cur",
"//ui/resources/cursors/cell.cur", "//ui/resources/cursors/cell.cur",
......
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