Commit fede7212 authored by dgrogan@chromium.org's avatar dgrogan@chromium.org

Probably broke Win7 Tests (dbg)(6)....

Probably broke Win7 Tests (dbg)(6). http://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%286%29/builds/27654/steps/browser_tests/logs/SendQuery

[ RUN      ] GcdPrivateAPITest.SendQuery
[4036:2900:0709/150928:ERROR:singleton_hwnd.cc(43)] Cannot create windows on non-UI thread!
[956:2412:0709/150928:WARNING:extension_apitest.cc(282)] Workaround for 177163, prematurely returning
c:\b\build\slave\win_builder__dbg_\build\src\chrome\browser\extensions\api\gcd_private\gcd_private_apitest.cc(276): error: Actual function call count doesn't match EXPECT_CALL(*test_service_discovery_client_, OnSendTo(std::string(reinterpret_cast\u003Cconst char*>(kQueryPacket), sizeof(kQueryPacket))))...
         Expected: to be called twice
           Actual: never called - unsatisfied and active
[  FAILED  ] GcdPrivateAPITest.SendQuery, where TypeParam =  and GetParam() =  (5746 ms)


Revert 282099 "Add API stubs for GCD device commands."

> Add API stubs for GCD device commands.
> Changed registration API to work for one network at once.
> Fixed comments.
> Replaced argument GCDDevice with just string id.
> 
> BUG=383167
> R=alexsemenov@chromium.org, asargent@chromium.org, asvitkine@chromium.org, noamsml@chromium.org
> 
> Review URL: https://codereview.chromium.org/363883002

TBR=vitalybuka@chromium.org

Review URL: https://codereview.chromium.org/385483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282175 0039d316-1c4b-4281-b951-d872f2087c98
parent a402eb74
......@@ -23,28 +23,21 @@ namespace gcd_private = api::gcd_private;
namespace {
const int kNumRequestsNeeded = 2;
const char kIDPrefixCloudPrinter[] = "cloudprint:";
const char kIDPrefixGcd[] = "gcd:";
const char kIDPrefixMdns[] = "mdns:";
scoped_ptr<Event> MakeDeviceStateChangedEvent(
scoped_ptr<Event> MakeCloudDeviceStateChangedEvent(
bool available,
const gcd_private::GCDDevice& device) {
scoped_ptr<base::ListValue> params =
gcd_private::OnDeviceStateChanged::Create(device);
scoped_ptr<Event> event(
new Event(gcd_private::OnDeviceStateChanged::kEventName, params.Pass()));
gcd_private::OnCloudDeviceStateChanged::Create(available, device);
scoped_ptr<Event> event(new Event(
gcd_private::OnCloudDeviceStateChanged::kEventName, params.Pass()));
return event.Pass();
}
scoped_ptr<Event> MakeDeviceRemovedEvent(const std::string& device) {
scoped_ptr<base::ListValue> params =
gcd_private::OnDeviceRemoved::Create(device);
scoped_ptr<Event> event(
new Event(gcd_private::OnDeviceRemoved::kEventName, params.Pass()));
return event.Pass();
}
const int kNumRequestsNeeded = 2;
const char kIDPrefixCloudPrinter[] = "cloudprint:";
const char kIDPrefixGcd[] = "gcd:";
const char kIDPrefixMdns[] = "mdns:";
GcdPrivateAPI::GCDApiFlowFactoryForTests* g_gcd_api_flow_factory = NULL;
......@@ -76,10 +69,8 @@ GcdPrivateAPI::GcdPrivateAPI(content::BrowserContext* context)
: num_device_listeners_(0), browser_context_(context) {
DCHECK(browser_context_);
if (EventRouter::Get(context)) {
EventRouter::Get(context)
->RegisterObserver(this, gcd_private::OnDeviceStateChanged::kEventName);
EventRouter::Get(context)
->RegisterObserver(this, gcd_private::OnDeviceRemoved::kEventName);
EventRouter::Get(context)->RegisterObserver(
this, gcd_private::OnCloudDeviceStateChanged::kEventName);
}
}
......@@ -96,36 +87,31 @@ GcdPrivateAPI::GetFactoryInstance() {
}
void GcdPrivateAPI::OnListenerAdded(const EventListenerInfo& details) {
if (details.event_name == gcd_private::OnDeviceStateChanged::kEventName ||
details.event_name == gcd_private::OnDeviceRemoved::kEventName) {
num_device_listeners_++;
if (num_device_listeners_ == 1) {
service_discovery_client_ =
local_discovery::ServiceDiscoverySharedClient::GetInstance();
privet_device_lister_.reset(new local_discovery::PrivetDeviceListerImpl(
service_discovery_client_.get(), this));
privet_device_lister_->Start();
}
num_device_listeners_++;
if (num_device_listeners_ == 1) {
service_discovery_client_ =
local_discovery::ServiceDiscoverySharedClient::GetInstance();
privet_device_lister_.reset(new local_discovery::PrivetDeviceListerImpl(
service_discovery_client_.get(), this));
privet_device_lister_->Start();
}
for (GCDDeviceMap::iterator i = known_devices_.begin();
i != known_devices_.end();
i++) {
EventRouter::Get(browser_context_)->DispatchEventToExtension(
details.extension_id, MakeDeviceStateChangedEvent(*i->second));
}
for (GCDDeviceMap::iterator i = known_devices_.begin();
i != known_devices_.end();
i++) {
EventRouter::Get(browser_context_)->DispatchEventToExtension(
details.extension_id,
MakeCloudDeviceStateChangedEvent(true, *i->second));
}
}
void GcdPrivateAPI::OnListenerRemoved(const EventListenerInfo& details) {
if (details.event_name == gcd_private::OnDeviceStateChanged::kEventName ||
details.event_name == gcd_private::OnDeviceRemoved::kEventName) {
num_device_listeners_--;
num_device_listeners_--;
if (num_device_listeners_ == 0) {
privet_device_lister_.reset();
service_discovery_client_ = NULL;
}
if (num_device_listeners_ == 0) {
privet_device_lister_.reset();
service_discovery_client_ = NULL;
}
}
......@@ -135,17 +121,17 @@ void GcdPrivateAPI::DeviceChanged(
const local_discovery::DeviceDescription& description) {
linked_ptr<gcd_private::GCDDevice> device(new gcd_private::GCDDevice);
device->setup_type = gcd_private::SETUP_TYPE_MDNS;
device->device_id = kIDPrefixMdns + name;
device->id_string = kIDPrefixMdns + name;
device->device_type = description.type;
device->device_name = description.name;
device->device_description = description.description;
if (!description.id.empty())
device->cloud_id.reset(new std::string(description.id));
known_devices_[device->device_id] = device;
known_devices_[device->id_string] = device;
EventRouter::Get(browser_context_)
->BroadcastEvent(MakeDeviceStateChangedEvent(*device));
->BroadcastEvent(MakeCloudDeviceStateChangedEvent(true, *device));
}
void GcdPrivateAPI::DeviceRemoved(const std::string& name) {
......@@ -154,7 +140,7 @@ void GcdPrivateAPI::DeviceRemoved(const std::string& name) {
known_devices_.erase(found);
EventRouter::Get(browser_context_)
->BroadcastEvent(MakeDeviceRemovedEvent(device->device_id));
->BroadcastEvent(MakeCloudDeviceStateChangedEvent(false, *device));
}
void GcdPrivateAPI::DeviceCacheFlushed() {
......@@ -162,7 +148,7 @@ void GcdPrivateAPI::DeviceCacheFlushed() {
i != known_devices_.end();
i++) {
EventRouter::Get(browser_context_)
->BroadcastEvent(MakeDeviceRemovedEvent(i->second->device_id));
->BroadcastEvent(MakeCloudDeviceStateChangedEvent(false, *i->second));
}
known_devices_.clear();
......@@ -239,9 +225,9 @@ void GcdPrivateGetCloudDeviceListFunction::CheckListingDone() {
linked_ptr<gcd_private::GCDDevice> device(new gcd_private::GCDDevice);
device->setup_type = gcd_private::SETUP_TYPE_CLOUD;
if (i->type == local_discovery::kGCDTypePrinter) {
device->device_id = kIDPrefixCloudPrinter + i->id;
device->id_string = kIDPrefixCloudPrinter + i->id;
} else {
device->device_id = kIDPrefixGcd + i->id;
device->id_string = kIDPrefixGcd + i->id;
}
device->cloud_id.reset(new std::string(i->id));
......@@ -291,23 +277,23 @@ bool GcdPrivateStartSetupFunction::RunAsync() {
return false;
}
GcdPrivateSetWiFiNetworkFunction::GcdPrivateSetWiFiNetworkFunction() {
GcdPrivateSetWiFiNetworksFunction::GcdPrivateSetWiFiNetworksFunction() {
}
GcdPrivateSetWiFiNetworkFunction::~GcdPrivateSetWiFiNetworkFunction() {
GcdPrivateSetWiFiNetworksFunction::~GcdPrivateSetWiFiNetworksFunction() {
}
bool GcdPrivateSetWiFiNetworkFunction::RunAsync() {
bool GcdPrivateSetWiFiNetworksFunction::RunAsync() {
return false;
}
GcdPrivateSetWiFiPasswordFunction::GcdPrivateSetWiFiPasswordFunction() {
GcdPrivateSetWiFiCredentialsFunction::GcdPrivateSetWiFiCredentialsFunction() {
}
GcdPrivateSetWiFiPasswordFunction::~GcdPrivateSetWiFiPasswordFunction() {
GcdPrivateSetWiFiCredentialsFunction::~GcdPrivateSetWiFiCredentialsFunction() {
}
bool GcdPrivateSetWiFiPasswordFunction::RunAsync() {
bool GcdPrivateSetWiFiCredentialsFunction::RunAsync() {
return false;
}
......@@ -331,56 +317,4 @@ bool GcdPrivateStopSetupFunction::RunAsync() {
return false;
}
GcdPrivateGetCommandDefinitionsFunction::
GcdPrivateGetCommandDefinitionsFunction() {
}
GcdPrivateGetCommandDefinitionsFunction::
~GcdPrivateGetCommandDefinitionsFunction() {
}
bool GcdPrivateGetCommandDefinitionsFunction::RunAsync() {
return false;
}
GcdPrivateInsertCommandFunction::GcdPrivateInsertCommandFunction() {
}
GcdPrivateInsertCommandFunction::~GcdPrivateInsertCommandFunction() {
}
bool GcdPrivateInsertCommandFunction::RunAsync() {
return false;
}
GcdPrivateGetCommandFunction::GcdPrivateGetCommandFunction() {
}
GcdPrivateGetCommandFunction::~GcdPrivateGetCommandFunction() {
}
bool GcdPrivateGetCommandFunction::RunAsync() {
return false;
}
GcdPrivateCancelCommandFunction::GcdPrivateCancelCommandFunction() {
}
GcdPrivateCancelCommandFunction::~GcdPrivateCancelCommandFunction() {
}
bool GcdPrivateCancelCommandFunction::RunAsync() {
return false;
}
GcdPrivateGetCommandsListFunction::GcdPrivateGetCommandsListFunction() {
}
GcdPrivateGetCommandsListFunction::~GcdPrivateGetCommandsListFunction() {
}
bool GcdPrivateGetCommandsListFunction::RunAsync() {
return false;
}
} // namespace extensions
......@@ -130,15 +130,15 @@ class GcdPrivateStartSetupFunction : public ChromeAsyncExtensionFunction {
private:
};
class GcdPrivateSetWiFiNetworkFunction : public ChromeAsyncExtensionFunction {
class GcdPrivateSetWiFiNetworksFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("gcdPrivate.setWiFiNetwork",
GCDPRIVATE_SETWIFINETWORK)
DECLARE_EXTENSION_FUNCTION("gcdPrivate.setWiFiNetworks",
GCDPRIVATE_SETWIFINETWORKS)
GcdPrivateSetWiFiNetworkFunction();
GcdPrivateSetWiFiNetworksFunction();
protected:
virtual ~GcdPrivateSetWiFiNetworkFunction();
virtual ~GcdPrivateSetWiFiNetworksFunction();
// AsyncExtensionFunction overrides.
virtual bool RunAsync() OVERRIDE;
......@@ -146,15 +146,16 @@ class GcdPrivateSetWiFiNetworkFunction : public ChromeAsyncExtensionFunction {
private:
};
class GcdPrivateSetWiFiPasswordFunction : public ChromeAsyncExtensionFunction {
class GcdPrivateSetWiFiCredentialsFunction
: public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("gcdPrivate.setWiFiPassword",
GCDPRIVATE_SETWIFIPASSWORD)
DECLARE_EXTENSION_FUNCTION("gcdPrivate.setWiFiCredentials",
GCDPRIVATE_SETWIFICREDENTIALS)
GcdPrivateSetWiFiPasswordFunction();
GcdPrivateSetWiFiCredentialsFunction();
protected:
virtual ~GcdPrivateSetWiFiPasswordFunction();
virtual ~GcdPrivateSetWiFiCredentialsFunction();
// AsyncExtensionFunction overrides.
virtual bool RunAsync() OVERRIDE;
......@@ -192,86 +193,6 @@ class GcdPrivateStopSetupFunction : public ChromeAsyncExtensionFunction {
private:
};
class GcdPrivateGetCommandDefinitionsFunction
: public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("gcdPrivate.getCommandDefinitions",
GCDPRIVATE_GETCOMMANDDEFINITIONS)
GcdPrivateGetCommandDefinitionsFunction();
protected:
virtual ~GcdPrivateGetCommandDefinitionsFunction();
// AsyncExtensionFunction overrides.
virtual bool RunAsync() OVERRIDE;
private:
};
class GcdPrivateInsertCommandFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("gcdPrivate.insertCommand",
GCDPRIVATE_INSERTCOMMAND)
GcdPrivateInsertCommandFunction();
protected:
virtual ~GcdPrivateInsertCommandFunction();
// AsyncExtensionFunction overrides.
virtual bool RunAsync() OVERRIDE;
private:
};
class GcdPrivateGetCommandFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("gcdPrivate.getCommand", GCDPRIVATE_GETCOMMAND)
GcdPrivateGetCommandFunction();
protected:
virtual ~GcdPrivateGetCommandFunction();
// AsyncExtensionFunction overrides.
virtual bool RunAsync() OVERRIDE;
private:
};
class GcdPrivateCancelCommandFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("gcdPrivate.cancelCommand",
GCDPRIVATE_CANCELCOMMAND)
GcdPrivateCancelCommandFunction();
protected:
virtual ~GcdPrivateCancelCommandFunction();
// AsyncExtensionFunction overrides.
virtual bool RunAsync() OVERRIDE;
private:
};
class GcdPrivateGetCommandsListFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("gcdPrivate.getCommandsList",
GCDPRIVATE_GETCOMMANDSLIST)
GcdPrivateGetCommandsListFunction();
protected:
virtual ~GcdPrivateGetCommandsListFunction();
// AsyncExtensionFunction overrides.
virtual bool RunAsync() OVERRIDE;
private:
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_
......@@ -10,12 +10,12 @@ namespace gcdPrivate {
// Represents a GCD device discovered locally or registered to a given user.
dictionary GCDDevice {
// Opaque device identifier to be passed to API.
DOMString deviceId;
// How this device was discovered.
SetupType setupType;
// Opaque device identifier to be passed to API.
DOMString idString;
// Cloud identifier string.
DOMString? cloudId;
......@@ -29,47 +29,39 @@ namespace gcdPrivate {
DOMString deviceDescription;
};
callback CloudDeviceListCallback = void(GCDDevice[] devices);
// |commandDefinitions| : Is "commandDefs" value of device described at
// https://developers.google.com/cloud-devices/v1/reference/devices
// TODO(vitalybuka): consider to describe object in IDL.
callback CommandDefinitionsCallback = void(object commandDefinitions);
// |command| : Described at
// https://developers.google.com/cloud-devices/v1/reference/commands
// TODO(vitalybuka): consider to describe object in IDL.
callback CommandCallback = void(object command);
// Represents wifi network credentials.
dictionary WiFiCredentials {
DOMString ssid;
DOMString password;
};
// |commands| : Array of commands described at
// https://developers.google.com/cloud-devices/v1/reference/commands
// TODO(vitalybuka): consider to describe object in IDL.
callback CommandListCallback = void(object[] commands);
callback CloudDeviceListCallback = void(GCDDevice[] devices);
interface Functions {
// Returns the list of cloud devices visible locally or available in the
// cloud for user account.
static void getCloudDeviceList(CloudDeviceListCallback callback);
// Queries network for local devices. Triggers an onDeviceStateChanged and
// onDeviceRemoved events. Call this function *only* after registering for
// onDeviceStateChanged and onDeviceRemoved events, or it will do nothing.
// Call this function *only* after registering for onDeviceStateChanged
// events, or it will do nothing. This will trigger an
// onLocalDeviceStateChanged event per device.
static void queryForNewLocalDevices();
// Starts device setup process. Returns id of setup process. Id should be
// used as |setupId| in all subsequent setup related calls, and for
// filtering setup events.
static long startSetup(DOMString deviceId);
static long startSetup(GCDDevice device);
// Sets WiFi network as reply to |onGetWifiNetworks| event.
// Sets WiFi network list as reply to |onGetWifiNetworks| event.
// |setupId| : The value returned by |startSetup|.
// |network| : The wifi network for device setup.
static void setWiFiNetwork(long setupId, DOMString network);
// |networks| : The list of network device should be registered on.
static void setWiFiNetworks(long setupId, DOMString[] networks);
// Sets WiFi network password as reply to |onGetWifiPassword| event.
// Sets WiFi network credentials as reply to |onGetWifiCredentials|
// event.
// |setupId| : The value returned by |startSetup|.
// |password| : The password for network selected with |setWiFiNetwork|.
static void setWiFiPassword(long setupId, DOMString password);
// |credentials| : The list of ssid with passwoors. The list is not required
// to match |networks| provided with |setWiFiNetworks| or
// |onGetWifiCredentials|.
static void setWiFiCredentials(long setupId, WiFiCredentials[] credentials);
// Confirms that security code known to application match to the code known
// to device.
......@@ -81,70 +73,24 @@ namespace gcdPrivate {
// starting new registration.
// |setupId| : The value returned by |startSetup|.
static void stopSetup(long setupId);
// Returns command definitions.
// |deviceId| : The device to get command definitions for.
// |callback| : The result callback.
static void getCommandDefinitions(DOMString deviceId,
CommandDefinitionsCallback callback);
// Creates and sends a new command.
// |deviceId| : The device to send the command to.
// |expireInMs| : The number of milliseconds since now before the command
// expires. Expired command should not be executed by device. Acceptable
// values are 10000 to 2592000000, inclusive. All values outside that range
// will be replaced by 2592000000.
// |command| : Described at
// https://developers.google.com/cloud-devices/v1/reference/commands
// |callback| : The result callback.
static void insertCommand(DOMString deviceId,
long expireInMs,
object command,
CommandCallback callback);
// Returns a particular command.
// |commandId| : Unique command ID.
// |callback| : The result callback.
static void getCommand(DOMString commandId, CommandCallback callback);
// Cancels a command.
// |commandId| : Unique command ID.
// |callback| : The result callback.
static void cancelCommand(DOMString commandId, CommandCallback callback);
// Lists all commands in order of creation.
// |deviceId| : The device to get the commands for.
// |byUser| : List all the commands issued by the user. Special value 'me'
// can be used to list by the current user.
// |state| : Command state.
// |callback| : The result callback.
static void getCommandsList(DOMString deviceId,
DOMString byUser,
DOMString state,
CommandListCallback callback);
};
interface Events {
// Subscribe to this event to start listening new or updated devices. New
// listeners will get called with all known devices on the network, and
// status updates for devices available through the cloud.
static void onDeviceStateChanged(GCDDevice device);
// Notifies that device has disappeared.
// |deviceId| : The device has disappeared.
static void onDeviceRemoved(DOMString deviceId);
// Subscribe to this event to start listening to cloud devices. New
// listeners will get called with all known devices on the network.
static void onCloudDeviceStateChanged(boolean available, GCDDevice device);
// Notifies app that setup is waiting for a wifi network. App should reply
// with |setWiFiNetwork|.
// Notifies app that setup is waiting for network list. App should reply
// with |setWiFiNetworks|.
// |setupId| : The value returned by |startSetup|.
static void onGetWifiNetwork(long setupId);
static void onGetWifiNetworks(long setupId);
// Notifies app that setup is waiting for password for the network provided
// with |setWiFiNetwork|. Even will be called if setup flow would unable to
// get password from the system.
// App should reply with |setWiFiPassword|.
// Notifies app that setup is waiting for credentions for |networks| list.
// App should reply with |setWiFiCredentials|.
// |setupId| : The value returned by |startSetup|.
static void onGetWifiPassword(long setupId);
// |networks| : A subset of the list provided in |setWiFiNetworks| for which
// setup flow is unable to find credentials
static void onGetWifiCredentials(long setupId, DOMString[] networks);
// Notifies app that setup is waiting for confirmation that code is the same
// as code known to device. App should reply with |confirmCode|, or
......@@ -157,7 +103,7 @@ namespace gcdPrivate {
// |setupId| : The value returned by |startSetup|.
static void onSetupSuccess(long setupId);
// Notifies app that setup is failed or stopped.
// Notifies app that setup is failed or stoped.
// |setupId| : The value returned by |startSetup|.
static void onSetupError(long setupId);
};
......
......@@ -8,13 +8,13 @@ onload = function() {
chrome.gcdPrivate.getCloudDeviceList(function(services) {
// Sort to avoid order dependence
services.sort(function(a,b) {
return a.deviceId.localeCompare(b.deviceId);
return a.idString.localeCompare(b.idString);
});
chrome.test.assertEq(2, services.length);
chrome.test.assertEq(services[0].setupType, "cloud");
chrome.test.assertEq(services[0].deviceId,
chrome.test.assertEq(services[0].idString,
"cloudprint:someCloudPrintID");
chrome.test.assertEq(services[0].cloudId, "someCloudPrintID");
chrome.test.assertEq(services[0].deviceType, "printer");
......@@ -24,7 +24,7 @@ onload = function() {
"someCloudPrintDescription");
chrome.test.assertEq(services[1].setupType, "cloud");
chrome.test.assertEq(services[1].deviceId, "gcd:someGCDID");
chrome.test.assertEq(services[1].idString, "gcd:someGCDID");
chrome.test.assertEq(services[1].cloudId, "someGCDID");
chrome.test.assertEq(services[1].deviceType, "someType");
chrome.test.assertEq(services[1].deviceName, "someGCDDisplayName");
......
......@@ -4,19 +4,21 @@
onload = function() {
chrome.test.runTests([
function receiveNewDevice() {
chrome.gcdPrivate.onDeviceStateChanged.addListener(
function(device) {
chrome.test.assertEq(device.setupType, "mdns");
chrome.test.assertEq(device.deviceId,
"mdns:myService._privet._tcp.local");
chrome.test.assertEq(device.deviceType, "printer");
chrome.test.assertEq(device.deviceName,
"Sample device");
chrome.test.assertEq(device.deviceDescription,
"Sample device description");
function receiveNewDevice() {
chrome.gcdPrivate.onCloudDeviceStateChanged.addListener(
function(available, device) {
chrome.test.assertTrue(available);
chrome.test.notifyPass();
})
chrome.test.assertEq(device.setupType, "mdns");
chrome.test.assertEq(device.idString,
"mdns:myService._privet._tcp.local");
chrome.test.assertEq(device.deviceType, "printer");
chrome.test.assertEq(device.deviceName,
"Sample device");
chrome.test.assertEq(device.deviceDescription,
"Sample device description");
chrome.test.notifyPass();
})
}]);
};
......@@ -4,12 +4,26 @@
onload = function() {
chrome.test.runTests([
function addRemoveDevice() {
chrome.gcdPrivate.onDeviceRemoved.addListener(
function(deviceId) {
chrome.test.assertEq(deviceId,
"mdns:myService._privet._tcp.local");
chrome.test.notifyPass();
})
function addRemoveDevice() {
var should_be_available = true;
chrome.gcdPrivate.onCloudDeviceStateChanged.addListener(
function(available, device) {
chrome.test.assertEq(available, should_be_available);
should_be_available = false;
chrome.test.assertEq(device.setupType, "mdns");
chrome.test.assertEq(device.idString,
"mdns:myService._privet._tcp.local");
chrome.test.assertEq(device.deviceType, "printer");
chrome.test.assertEq(device.deviceName,
"Sample device");
chrome.test.assertEq(device.deviceDescription,
"Sample device description");
if (!available) {
// Only pass after device is removed
chrome.test.notifyPass();
}
})
}]);
};
......@@ -4,10 +4,11 @@
onload = function() {
chrome.test.runTests([
function receiveNewDevice() {
chrome.gcdPrivate.onDeviceStateChanged.addListener(function(device) {});
chrome.gcdPrivate.queryForNewLocalDevices();
chrome.test.notifyPass();
}
]);
function receiveNewDevice() {
chrome.gcdPrivate.onCloudDeviceStateChanged.addListener(
function(available, device) {});
chrome.gcdPrivate.queryForNewLocalDevices();
chrome.test.notifyPass();
}]);
};
......@@ -884,19 +884,14 @@ enum HistogramValue {
GCDPRIVATE_GETCLOUDDEVICELIST,
GCDPRIVATE_QUERYFORNEWLOCALDEVICES,
GCDPRIVATE_STARTSETUP,
GCDPRIVATE_SETWIFINETWORK,
GCDPRIVATE_SETWIFIPASSWORD,
GCDPRIVATE_SETWIFINETWORKS,
GCDPRIVATE_SETWIFICREDENTIALS,
GCDPRIVATE_CONFIRMCODE,
GCDPRIVATE_STOPSETUP,
TABS_SETZOOM,
TABS_GETZOOM,
TABS_SETZOOMSETTINGS,
TABS_GETZOOMSETTINGS,
GCDPRIVATE_GETCOMMANDDEFINITIONS,
GCDPRIVATE_INSERTCOMMAND,
GCDPRIVATE_GETCOMMAND,
GCDPRIVATE_CANCELCOMMAND,
GCDPRIVATE_GETCOMMANDSLIST,
// Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms/histograms.xml.
ENUM_BOUNDARY
......
......@@ -38425,11 +38425,6 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="831" label="TABS_GETZOOM"/>
<int value="832" label="TABS_SETZOOMSETTINGS"/>
<int value="833" label="TABS_GETZOOMSETTINGS"/>
<int value="834" label="GCDPRIVATE_GETCOMMANDDEFS"/>
<int value="835" label="GCDPRIVATE_INSERTCOMMAND"/>
<int value="836" label="GCDPRIVATE_GETCOMMAND"/>
<int value="837" label="GCDPRIVATE_CANCELCOMMAND"/>
<int value="838" label="GCDPRIVATE_GETCOMMANDSLIST"/>
</enum>
<enum name="ExtensionInstallCause" type="int">
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