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

Side by Side Diff: chrome/browser/extensions/api/idle/idle_api_unittest.cc

Issue 10750016: Moved c/b/e/*idle* to c/b/e/api/idle/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sync with trunk 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 6
7 #include "chrome/browser/extensions/extension_idle_api.h" 7 #include "chrome/browser/extensions/api/idle/idle_api.h"
8
9 using extensions::ExtensionIdleCache;
8 10
9 TEST(ExtensionIdleApiTest, CacheTest) { 11 TEST(ExtensionIdleApiTest, CacheTest) {
10 double throttle_interval = ExtensionIdleCache::get_throttle_interval(); 12 double throttle_interval = ExtensionIdleCache::get_throttle_interval();
11 int min_threshold = ExtensionIdleCache::get_min_threshold(); 13 int min_threshold = ExtensionIdleCache::get_min_threshold();
12 double now = 10 * min_threshold; 14 double now = 10 * min_threshold;
13 15
14 EXPECT_EQ(IDLE_STATE_UNKNOWN, 16 EXPECT_EQ(IDLE_STATE_UNKNOWN,
15 ExtensionIdleCache::CalculateState(min_threshold, now)); 17 ExtensionIdleCache::CalculateState(min_threshold, now));
16 18
17 ExtensionIdleCache::Update(2 * min_threshold, IDLE_STATE_IDLE, now); 19 ExtensionIdleCache::Update(2 * min_threshold, IDLE_STATE_IDLE, now);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 ExtensionIdleCache::Update(2 * min_threshold, IDLE_STATE_LOCKED, now); 114 ExtensionIdleCache::Update(2 * min_threshold, IDLE_STATE_LOCKED, now);
113 115
114 now += 0.2 * throttle_interval; 116 now += 0.2 * throttle_interval;
115 ExtensionIdleCache::Update(4 * min_threshold, IDLE_STATE_ACTIVE, now); 117 ExtensionIdleCache::Update(4 * min_threshold, IDLE_STATE_ACTIVE, now);
116 118
117 // Last reported state was ACTIVE. 119 // Last reported state was ACTIVE.
118 EXPECT_EQ(IDLE_STATE_ACTIVE, 120 EXPECT_EQ(IDLE_STATE_ACTIVE,
119 ExtensionIdleCache::CalculateState(6 * min_threshold, 121 ExtensionIdleCache::CalculateState(6 * min_threshold,
120 now + 0.3 * throttle_interval)); 122 now + 0.3 * throttle_interval));
121 } 123 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/idle/idle_api_constants.cc ('k') | chrome/browser/extensions/api/idle/idle_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698