Permalink
Browse files

Automated g4 rollback

*** Reason for rollback ***

causing build breakages, investigating

*** Original change description ***

Fix reference to private property in mockactivitymonitor.

DELTA=149 (1 added, 128 deleted, 20 changed)


Revision created by MOE tool push_codebase.
MOE_MIGRATION=6212


git-svn-id: http://closure-library.googlecode.com/svn/trunk@2475 0b95b8e8-c90f-11de-9d4f-f947ee5921c8
  • Loading branch information...
1 parent f42e33e commit af6fdd1170be8146e701353cbe89a09ca34d86d2 nnaze@google.com committed Jan 29, 2013
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -78,7 +78,7 @@ goog.ui.ActivityMonitor = function(opt_domHelper, opt_useBubble) {
this.addDocument(goog.dom.getDomHelper().getDocument());
} else if (goog.isArray(opt_domHelper)) {
for (var i = 0; i < opt_domHelper.length; i++) {
- this.addDocument(opt_domHelper[i].getDocument());
+ this.addDocument(opt_domHelper[i].getDocument());
}
} else {
this.addDocument(opt_domHelper.getDocument());
@@ -139,16 +139,11 @@ goog.ui.ActivityMonitor.MIN_EVENT_SPACING = 3 * 1000;
* @type {Array.<goog.events.EventType>}
* @private
*/
-goog.ui.ActivityMonitor.userEventTypesBody_ = [
- goog.events.EventType.CLICK,
- goog.events.EventType.DBLCLICK,
- goog.events.EventType.MOUSEDOWN,
- goog.events.EventType.MOUSEMOVE,
- goog.events.EventType.MOUSEUP,
- goog.events.EventType.TOUCHEND,
- goog.events.EventType.TOUCHMOVE,
- goog.events.EventType.TOUCHSTART
-];
+goog.ui.ActivityMonitor.userEventTypesBody_ =
+ [goog.events.EventType.CLICK, goog.events.EventType.DBLCLICK,
+ goog.events.EventType.MOUSEDOWN, goog.events.EventType.MOUSEUP,
+ goog.events.EventType.MOUSEMOVE, goog.events.EventType.TOUCHSTART,
+ goog.events.EventType.TOUCHMOVE, goog.events.EventType.TOUCHEND];
/**
@@ -157,7 +152,7 @@ goog.ui.ActivityMonitor.userEventTypesBody_ = [
* @private
*/
goog.ui.ActivityMonitor.userEventTypesDocuments_ =
- [goog.events.EventType.KEYDOWN, goog.events.EventType.KEYUP];
+ [goog.events.EventType.KEYDOWN, goog.events.EventType.KEYUP];
/**
@@ -241,8 +236,7 @@ goog.ui.ActivityMonitor.prototype.handleEvent_ = function(e) {
}
if (update) {
- var type = goog.asserts.assertString(e.type);
- this.updateIdleTime(goog.now(), type);
+ this.updateIdleTime_(goog.now(), /** @type {string} */ (e.type));
}
};
@@ -252,20 +246,19 @@ goog.ui.ActivityMonitor.prototype.handleEvent_ = function(e) {
* events that should update idle time.
*/
goog.ui.ActivityMonitor.prototype.resetTimer = function() {
- this.updateIdleTime(goog.now(), 'manual');
+ this.updateIdleTime_(goog.now(), 'manual');
};
/**
- * Updates the idle time and fires an event if time has elapsed since
- * the last update.
+ * Does the work of updating the idle time and firing an event
* @param {number} eventTime Time (in MS) of the event that cleared the idle
- * timer.
+ * timer.
* @param {string} eventType Type of the event, used only for debugging.
- * @protected
+ * @private
*/
-goog.ui.ActivityMonitor.prototype.updateIdleTime = function(
- eventTime, eventType) {
+goog.ui.ActivityMonitor.prototype.updateIdleTime_ = function(eventTime,
+ eventType) {
// update internal state noting whether the user was idle
this.lastEventTime_ = eventTime;
this.lastEventType_ = eventType;
@@ -31,14 +31,7 @@ goog.require('goog.ui.ActivityMonitor');
* @extends {goog.ui.ActivityMonitor}
*/
goog.ui.MockActivityMonitor = function() {
- goog.base(this);
-
- /**
- * Tracks whether an event has been fired. Used by simulateEvent.
- * @type {boolean}
- * @private
- */
- this.eventFired_ = false;
+ goog.ui.ActivityMonitor.call(this);
};
goog.inherits(goog.ui.MockActivityMonitor, goog.ui.ActivityMonitor);
@@ -49,22 +42,13 @@ goog.inherits(goog.ui.MockActivityMonitor, goog.ui.ActivityMonitor);
* not idle. If not specified, defaults to MOUSEMOVE.
*/
goog.ui.MockActivityMonitor.prototype.simulateEvent = function(opt_type) {
+ var type = opt_type || goog.events.EventType.MOUSEMOVE;
var eventTime = goog.now();
- var eventType = opt_type || goog.events.EventType.MOUSEMOVE;
-
- this.eventFired_ = false;
- this.updateIdleTime(eventTime, eventType);
-
- if (!this.eventFired_) {
- this.dispatchEvent(goog.ui.ActivityMonitor.Event.ACTIVITY);
- }
-};
+ // update internal state noting whether the user was idle
+ this.lastEventTime_ = eventTime;
+ this.lastEventType_ = type;
-/**
- * @override
- */
-goog.ui.MockActivityMonitor.prototype.dispatchEvent = function(e) {
- goog.base(this, 'dispatchEvent', e);
- this.eventFired_ = true;
+ // dispatch event
+ this.dispatchEvent(goog.ui.ActivityMonitor.Event.ACTIVITY);
};
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright 2013 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
-<head>
-<meta http-equiv="X-UA-Compatible" content="IE=edge">
-<title>Closure Unit Tests - goog.ui.MockActivityMonitor</title>
-<script src="../base.js"></script>
-<script>
-goog.require('goog.ui.MockActivityMonitorTest');
-</script>
-</head>
-<body>
-</body>
-</html>
@@ -1,69 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-/**
- * @fileoverview Tests for goog.ui.MockActivityMonitorTest
- * @author nnaze@google.com (Nathan Naze)
- */
-
-goog.provide('goog.ui.MockActivityMonitorTest');
-
-goog.require('goog.testing.jsunit');
-goog.require('goog.testing.recordFunction');
-goog.require('goog.ui.MockActivityMonitor');
-goog.require('goog.ui.ActivityMonitor');
-goog.require('goog.functions');
-
-goog.setTestOnly('goog.ui.MockActivityMonitorTest');
-
-var googNow = goog.now;
-var monitor;
-var recordedFunction;
-var replacer;
-
-function setUp() {
- monitor = new goog.ui.MockActivityMonitor();
- recordedFunction = goog.testing.recordFunction();
-
- goog.events.listen(
- monitor,
- goog.ui.ActivityMonitor.Event.ACTIVITY,
- recordedFunction);
-}
-
-function tearDown() {
- goog.dispose(monitor);
- goog.now = googNow;
-}
-
-function testEventFireSameTime() {
- goog.now = goog.functions.constant(1000);
-
- monitor.simulateEvent();
- assertEquals(1, recordedFunction.getCallCount());
-
- monitor.simulateEvent();
- assertEquals(2, recordedFunction.getCallCount());
-}
-
-function testEventFireDifferingTime() {
- goog.now = goog.functions.constant(1000);
- monitor.simulateEvent();
- assertEquals(1, recordedFunction.getCallCount());
-
- goog.now = goog.functions.constant(1001);
- monitor.simulateEvent();
- assertEquals(2, recordedFunction.getCallCount());
-}

0 comments on commit af6fdd1

Please sign in to comment.