summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 20:14:37 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-10 20:14:37 +0000
commit670e362c28e8a92dda5dd537cca662d283ffc2a8 (patch)
tree276a950ccbba9ed338bf9a67a133bed97bc788ef
parentdc3e3e900426c7e620071fa4b8feebfdb6b84166 (diff)
downloadchromium_src-670e362c28e8a92dda5dd537cca662d283ffc2a8.zip
chromium_src-670e362c28e8a92dda5dd537cca662d283ffc2a8.tar.gz
chromium_src-670e362c28e8a92dda5dd537cca662d283ffc2a8.tar.bz2
Revert 59123 - Don't use the return value of rlz_lib::SendFinancialPing() as the return value
of the chrome extension API, since a false does not represent an error. Added an optional callback to the API so that caller can determine if the ping was sent or not. This CL is to reapply change 58827, which was reverted due to a test break. I found an uninitialized variable in the underlying RLZ code, see http://code.google.com/p/rlz/source/detail?r=18 for the fix. This CL includes a bump of the RLZ library to get this fix. The tests have been expanded a bit too since 58827. BUG=54294 TEST=n/a Review URL: http://codereview.chromium.org/3350016 TBR=rogerta@google.com Review URL: http://codereview.chromium.org/3330019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59138 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--chrome/browser/extensions/extension_rlz_apitest.cc6
-rw-r--r--chrome/browser/extensions/extension_rlz_module.cc16
-rw-r--r--chrome/common/extensions/api/extension_api.json3
-rw-r--r--chrome/test/data/extensions/api_test/rlz/test.js27
5 files changed, 11 insertions, 43 deletions
diff --git a/DEPS b/DEPS
index cddbb2c..4988a43 100644
--- a/DEPS
+++ b/DEPS
@@ -217,7 +217,7 @@ deps_os = {
Var("nacl_revision")),
"src/rlz":
- (Var("googlecode_url") % "rlz") + "/trunk@18",
+ (Var("googlecode_url") % "rlz") + "/trunk@17",
},
"mac": {
"src/chrome/tools/test/reference_build/chrome_mac":
diff --git a/chrome/browser/extensions/extension_rlz_apitest.cc b/chrome/browser/extensions/extension_rlz_apitest.cc
index ce97ae0f..c9c1416 100644
--- a/chrome/browser/extensions/extension_rlz_apitest.cc
+++ b/chrome/browser/extensions/extension_rlz_apitest.cc
@@ -55,10 +55,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Rlz) {
KEY_READ);
ASSERT_FALSE(key.Valid());
- key.Open(HKEY_CURRENT_USER, L"Software\\Google\\Common\\Rlz\\Events\\D",
- KEY_READ);
- ASSERT_FALSE(key.Valid());
-
// Mock out experimental.rlz.sendFinancialPing().
ASSERT_TRUE(ExtensionFunctionDispatcher::OverrideFunction(
"experimental.rlz.sendFinancialPing",
@@ -70,7 +66,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Rlz) {
// Now run all the tests.
ASSERT_TRUE(RunExtensionTest("rlz")) << message_;
- ASSERT_EQ(3, MockRlzSendFinancialPingFunction::expected_count());
+ ASSERT_EQ(1, MockRlzSendFinancialPingFunction::expected_count());
ExtensionFunctionDispatcher::ResetFunctions();
// Now make sure we recorded what was expected. If the code in test.js
diff --git a/chrome/browser/extensions/extension_rlz_module.cc b/chrome/browser/extensions/extension_rlz_module.cc
index e31fc69..25724be 100644
--- a/chrome/browser/extensions/extension_rlz_module.cc
+++ b/chrome/browser/extensions/extension_rlz_module.cc
@@ -144,18 +144,10 @@ bool RlzSendFinancialPingFunction::RunImpl() {
bool exclude_machine_id;
EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(6, &exclude_machine_id));
- // rlz_lib::SendFinancialPing() will not send a ping more often than once in
- // any 24-hour period. Calling it more often has no effect. If a ping is
- // not sent false is returned, but this is not an error, so we should not
- // use the return value of rlz_lib::SendFinancialPing() as the return value
- // of this function. Callers interested in the return value can register
- // an optional callback function.
- bool sent = rlz_lib::SendFinancialPing(product, access_points.get(),
- signature.c_str(), brand.c_str(),
- id.c_str(), lang.c_str(),
- exclude_machine_id);
- result_.reset(Value::CreateBooleanValue(sent));
- return true;
+ return rlz_lib::SendFinancialPing(product, access_points.get(),
+ signature.c_str(), brand.c_str(),
+ id.c_str(), lang.c_str(),
+ exclude_machine_id);
}
bool RlzClearProductStateFunction::RunImpl() {
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 2c53f0f..da9126d 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -3141,8 +3141,7 @@
{"name": "brand", "type": "string"},
{"name": "id", "type": "string"},
{"name": "lang", "type": "string"},
- {"name": "exclude_machine_id", "type": "boolean"},
- {"name": "callback", "type": "function", "optional": true, "parameters": [{"name": "sent", "type": "boolean"}]}
+ {"name": "exclude_machine_id", "type": "boolean"}
]
},
{
diff --git a/chrome/test/data/extensions/api_test/rlz/test.js b/chrome/test/data/extensions/api_test/rlz/test.js
index 1214b6d..6fb4239 100644
--- a/chrome/test/data/extensions/api_test/rlz/test.js
+++ b/chrome/test/data/extensions/api_test/rlz/test.js
@@ -135,30 +135,11 @@ chrome.test.runTests([
} catch(ex) {
}
- // Valid call. Should send a ping.
- chrome.experimental.rlz.sendFinancialPing('D', ['D3'], 'sig', 'TEST',
- 'id', 'en', false,
- function(sent) {
- if (sent) {
- chrome.test.succeed();
- } else {
- chrome.test.fail();
- }
- });
-
- // Try another call, this time the ping should not be sent.
- chrome.experimental.rlz.sendFinancialPing('D', ['D3'], 'sig', 'TEST',
- 'id', 'en', false,
- function(sent) {
- if (sent) {
- chrome.test.fail();
- } else {
- chrome.test.succeed();
- }
- });
-
- // Valid call. Test that callback does not need to be specified.
+ // Valid call.
chrome.experimental.rlz.sendFinancialPing('D', ['D3'], 'sig', 'TEST',
'id', 'en', false);
+
+ chrome.test.succeed();
}
]);
+