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

Side by Side Diff: chrome/browser/extensions/error_console/error_console_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/extensions/error_console/error_console.h" 5 #include "chrome/browser/extensions/error_console/error_console.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "chrome/common/extensions/features/feature_channel.h" 12 #include "chrome/common/extensions/features/feature_channel.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
15 #include "components/crx_file/id_util.h" 15 #include "components/crx_file/id_util.h"
16 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "extensions/browser/extension_error.h" 17 #include "extensions/browser/extension_error.h"
17 #include "extensions/browser/extension_error_test_util.h" 18 #include "extensions/browser/extension_error_test_util.h"
18 #include "extensions/browser/extension_registry.h" 19 #include "extensions/browser/extension_registry.h"
19 #include "extensions/common/constants.h" 20 #include "extensions/common/constants.h"
20 #include "extensions/common/extension_builder.h" 21 #include "extensions/common/extension_builder.h"
21 #include "extensions/common/feature_switch.h" 22 #include "extensions/common/feature_switch.h"
22 #include "extensions/common/value_builder.h" 23 #include "extensions/common/value_builder.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 25
25 namespace extensions { 26 namespace extensions {
(...skipping 12 matching lines...) Expand all
38 // Errors are only kept if we have the FeatureSwitch and have Developer Mode 39 // Errors are only kept if we have the FeatureSwitch and have Developer Mode
39 // enabled. 40 // enabled.
40 FeatureSwitch::error_console()->SetOverrideValue( 41 FeatureSwitch::error_console()->SetOverrideValue(
41 FeatureSwitch::OVERRIDE_ENABLED); 42 FeatureSwitch::OVERRIDE_ENABLED);
42 profile_.reset(new TestingProfile); 43 profile_.reset(new TestingProfile);
43 profile_->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); 44 profile_->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true);
44 error_console_ = ErrorConsole::Get(profile_.get()); 45 error_console_ = ErrorConsole::Get(profile_.get());
45 } 46 }
46 47
47 protected: 48 protected:
49 content::TestBrowserThreadBundle thread_bundle_;
48 scoped_ptr<TestingProfile> profile_; 50 scoped_ptr<TestingProfile> profile_;
49 ErrorConsole* error_console_; 51 ErrorConsole* error_console_;
50 }; 52 };
51 53
52 // Test that the error console is enabled/disabled appropriately. 54 // Test that the error console is enabled/disabled appropriately.
53 TEST_F(ErrorConsoleUnitTest, EnableAndDisableErrorConsole) { 55 TEST_F(ErrorConsoleUnitTest, EnableAndDisableErrorConsole) {
54 // Start in Dev Channel, without the feature switch. 56 // Start in Dev Channel, without the feature switch.
55 scoped_ptr<ScopedCurrentChannel> channel_override( 57 scoped_ptr<ScopedCurrentChannel> channel_override(
56 new ScopedCurrentChannel(chrome::VersionInfo::CHANNEL_DEV)); 58 new ScopedCurrentChannel(chrome::VersionInfo::CHANNEL_DEV));
57 ASSERT_EQ(chrome::VersionInfo::CHANNEL_DEV, GetCurrentChannel()); 59 ASSERT_EQ(chrome::VersionInfo::CHANNEL_DEV, GetCurrentChannel());
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 error_console_->ReportError( 269 error_console_->ReportError(
268 CreateNewRuntimeError(packed_extension->id(), "runtime error 4")); 270 CreateNewRuntimeError(packed_extension->id(), "runtime error 4"));
269 EXPECT_EQ(2u, // We should still have the first two errors. 271 EXPECT_EQ(2u, // We should still have the first two errors.
270 error_console_->GetErrorsForExtension( 272 error_console_->GetErrorsForExtension(
271 unpacked_extension->id()).size()); 273 unpacked_extension->id()).size());
272 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension( 274 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension(
273 unpacked_extension->id())); 275 unpacked_extension->id()));
274 } 276 }
275 277
276 } // namespace extensions 278 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698