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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "chrome/common/extensions/features/feature_channel.h" 14 #include "chrome/common/extensions/features/feature_channel.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
16 #include "components/crx_file/id_util.h" 17 #include "components/crx_file/id_util.h"
17 #include "components/prefs/pref_service.h" 18 #include "components/prefs/pref_service.h"
18 #include "components/version_info/version_info.h" 19 #include "components/version_info/version_info.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 20 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "extensions/browser/extension_error.h" 21 #include "extensions/browser/extension_error.h"
21 #include "extensions/browser/extension_error_test_util.h" 22 #include "extensions/browser/extension_error_test_util.h"
(...skipping 21 matching lines...) Expand all
43 // enabled. 44 // enabled.
44 FeatureSwitch::error_console()->SetOverrideValue( 45 FeatureSwitch::error_console()->SetOverrideValue(
45 FeatureSwitch::OVERRIDE_ENABLED); 46 FeatureSwitch::OVERRIDE_ENABLED);
46 profile_.reset(new TestingProfile); 47 profile_.reset(new TestingProfile);
47 profile_->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true); 48 profile_->GetPrefs()->SetBoolean(prefs::kExtensionsUIDeveloperMode, true);
48 error_console_ = ErrorConsole::Get(profile_.get()); 49 error_console_ = ErrorConsole::Get(profile_.get());
49 } 50 }
50 51
51 protected: 52 protected:
52 content::TestBrowserThreadBundle thread_bundle_; 53 content::TestBrowserThreadBundle thread_bundle_;
53 scoped_ptr<TestingProfile> profile_; 54 std::unique_ptr<TestingProfile> profile_;
54 ErrorConsole* error_console_; 55 ErrorConsole* error_console_;
55 }; 56 };
56 57
57 // Test that the error console is enabled/disabled appropriately. 58 // Test that the error console is enabled/disabled appropriately.
58 TEST_F(ErrorConsoleUnitTest, EnableAndDisableErrorConsole) { 59 TEST_F(ErrorConsoleUnitTest, EnableAndDisableErrorConsole) {
59 // Start in Dev Channel, without the feature switch. 60 // Start in Dev Channel, without the feature switch.
60 scoped_ptr<ScopedCurrentChannel> channel_override( 61 std::unique_ptr<ScopedCurrentChannel> channel_override(
61 new ScopedCurrentChannel(version_info::Channel::DEV)); 62 new ScopedCurrentChannel(version_info::Channel::DEV));
62 ASSERT_EQ(version_info::Channel::DEV, GetCurrentChannel()); 63 ASSERT_EQ(version_info::Channel::DEV, GetCurrentChannel());
63 FeatureSwitch::error_console()->SetOverrideValue( 64 FeatureSwitch::error_console()->SetOverrideValue(
64 FeatureSwitch::OVERRIDE_DISABLED); 65 FeatureSwitch::OVERRIDE_DISABLED);
65 66
66 // At the start, the error console should be enabled, and specifically 67 // At the start, the error console should be enabled, and specifically
67 // enabled for the chrome:extensions page. 68 // enabled for the chrome:extensions page.
68 EXPECT_TRUE(error_console_->enabled()); 69 EXPECT_TRUE(error_console_->enabled());
69 EXPECT_TRUE(error_console_->IsEnabledForChromeExtensionsPage()); 70 EXPECT_TRUE(error_console_->IsEnabledForChromeExtensionsPage());
70 EXPECT_FALSE(error_console_->IsEnabledForAppsDeveloperTools()); 71 EXPECT_FALSE(error_console_->IsEnabledForAppsDeveloperTools());
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 error_console_->ReportError( 273 error_console_->ReportError(
273 CreateNewRuntimeError(packed_extension->id(), "runtime error 4")); 274 CreateNewRuntimeError(packed_extension->id(), "runtime error 4"));
274 EXPECT_EQ(2u, // We should still have the first two errors. 275 EXPECT_EQ(2u, // We should still have the first two errors.
275 error_console_->GetErrorsForExtension( 276 error_console_->GetErrorsForExtension(
276 unpacked_extension->id()).size()); 277 unpacked_extension->id()).size());
277 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension( 278 EXPECT_FALSE(error_console_->IsReportingEnabledForExtension(
278 unpacked_extension->id())); 279 unpacked_extension->id()));
279 } 280 }
280 281
281 } // namespace extensions 282 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/error_console/error_console.cc ('k') | chrome/browser/extensions/event_router_forwarder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698