Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm

Issue 10834203: Integrate invalidation API into ChromeToMobileService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, add RegisterForDeviceListInvalidations util function. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm
index c1efcb27c6949562d5d6d85d19bfbe6ec5fd93f6..44784ce932690627c9bcdf8e5203d295c5d08a48 100644
--- a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller_unittest.mm
@@ -19,15 +19,15 @@ class MockChromeToMobileService : public ChromeToMobileService {
// ChromeToMobileService overrides:
virtual const base::ListValue* GetMobiles() const OVERRIDE;
- MOCK_METHOD0(RequestMobileListUpdate, void());
MOCK_METHOD2(GenerateSnapshot, void(Browser* browser,
base::WeakPtr<Observer> observer));
- MOCK_METHOD4(SendToMobile, void(const base::DictionaryValue& mobile,
+ MOCK_METHOD4(SendToMobile, void(const base::DictionaryValue* mobile,
const FilePath& snapshot,
Browser* browser,
base::WeakPtr<Observer> observer));
MOCK_METHOD1(DeleteSnapshot, void(const FilePath& snapshot));
MOCK_CONST_METHOD1(LogMetric, void(ChromeToMobileService::Metric));
+ MOCK_METHOD0(RequestDeviceSearch, void());
// A set of mock mobile devices, kept in lieu of the list in profile prefs.
base::ListValue mobiles_;
@@ -36,7 +36,9 @@ class MockChromeToMobileService : public ChromeToMobileService {
void MockChromeToMobileService::AddDevices(size_t count) {
for(size_t i = 0; i < count; i++) {
base::DictionaryValue* device = new base::DictionaryValue();
+ device->SetString("type", "Device Type");
device->SetString("name", "Device Name");
+ device->SetString("id", "Device ID");
mobiles_.Append(device);
}
}
@@ -115,10 +117,10 @@ class ChromeToMobileBubbleControllerTest : public CocoaTest {
};
TEST_F(ChromeToMobileBubbleControllerTest, OneDevice) {
- EXPECT_CALL(service_, RequestMobileListUpdate());
EXPECT_CALL(service_, GenerateSnapshot(NULL, testing::_));
EXPECT_CALL(service_, DeleteSnapshot(testing::_));
EXPECT_CALL(service_, LogMetric(ChromeToMobileService::BUBBLE_SHOWN));
+ EXPECT_CALL(service_, RequestDeviceSearch()).Times(0);
service_.AddDevices(1);
CreateBubble();
@@ -126,10 +128,10 @@ TEST_F(ChromeToMobileBubbleControllerTest, OneDevice) {
}
TEST_F(ChromeToMobileBubbleControllerTest, TwoDevices) {
- EXPECT_CALL(service_, RequestMobileListUpdate());
EXPECT_CALL(service_, GenerateSnapshot(NULL, testing::_));
EXPECT_CALL(service_, DeleteSnapshot(testing::_));
EXPECT_CALL(service_, LogMetric(ChromeToMobileService::BUBBLE_SHOWN));
+ EXPECT_CALL(service_, RequestDeviceSearch()).Times(0);
service_.AddDevices(2);
CreateBubble();
@@ -137,10 +139,10 @@ TEST_F(ChromeToMobileBubbleControllerTest, TwoDevices) {
}
TEST_F(ChromeToMobileBubbleControllerTest, ThreeDevices) {
- EXPECT_CALL(service_, RequestMobileListUpdate());
EXPECT_CALL(service_, GenerateSnapshot(NULL, testing::_));
EXPECT_CALL(service_, DeleteSnapshot(testing::_));
EXPECT_CALL(service_, LogMetric(ChromeToMobileService::BUBBLE_SHOWN));
+ EXPECT_CALL(service_, RequestDeviceSearch()).Times(0);
service_.AddDevices(3);
CreateBubble();
@@ -149,11 +151,11 @@ TEST_F(ChromeToMobileBubbleControllerTest, ThreeDevices) {
TEST_F(ChromeToMobileBubbleControllerTest, SendWithoutSnapshot) {
FilePath path;
- EXPECT_CALL(service_, RequestMobileListUpdate());
EXPECT_CALL(service_, GenerateSnapshot(NULL, testing::_));
EXPECT_CALL(service_, SendToMobile(testing::_, path, NULL, testing::_));
EXPECT_CALL(service_, DeleteSnapshot(testing::_));
EXPECT_CALL(service_, LogMetric(ChromeToMobileService::BUBBLE_SHOWN));
+ EXPECT_CALL(service_, RequestDeviceSearch()).Times(0);
service_.AddDevices(1);
CreateBubble();
@@ -162,12 +164,12 @@ TEST_F(ChromeToMobileBubbleControllerTest, SendWithoutSnapshot) {
TEST_F(ChromeToMobileBubbleControllerTest, SendWithSnapshot) {
FilePath path("path.mht");
- EXPECT_CALL(service_, RequestMobileListUpdate());
EXPECT_CALL(service_, GenerateSnapshot(NULL, testing::_));
EXPECT_CALL(service_, SendToMobile(testing::_, path, NULL, testing::_));
EXPECT_CALL(service_, DeleteSnapshot(testing::_));
EXPECT_CALL(service_, LogMetric(ChromeToMobileService::BUBBLE_SHOWN));
EXPECT_CALL(service_, LogMetric(ChromeToMobileService::SNAPSHOT_GENERATED));
+ EXPECT_CALL(service_, RequestDeviceSearch()).Times(0);
service_.AddDevices(1);
CreateBubble();

Powered by Google App Engine
This is Rietveld 408576698