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

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

Issue 12546016: Remove the Extensions URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile gdi. Created 7 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 | Annotate | Revision Log
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/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/extensions/error_console/extension_error.h" 10 #include "chrome/browser/extensions/error_console/extension_error.h"
11 #include "chrome/test/base/testing_profile.h" 11 #include "chrome/test/base/testing_profile.h"
12 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "extensions/common/id_util.h" 13 #include "extensions/common/id_util.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 using base::string16; 16 using base::string16;
16 using base::UTF8ToUTF16; 17 using base::UTF8ToUTF16;
17 18
18 namespace extensions { 19 namespace extensions {
19 20
20 namespace { 21 namespace {
21 22
22 scoped_ptr<ExtensionError> CreateNewManifestError(bool from_incognito) { 23 scoped_ptr<ExtensionError> CreateNewManifestError(bool from_incognito) {
23 return scoped_ptr<ExtensionError>( 24 return scoped_ptr<ExtensionError>(
24 new ManifestParsingError(from_incognito, 25 new ManifestParsingError(from_incognito,
25 UTF8ToUTF16("source"), 26 UTF8ToUTF16("source"),
26 UTF8ToUTF16("message"), 27 UTF8ToUTF16("message"),
27 0u /* line number */ )); 28 0u /* line number */ ));
28 } 29 }
29 30
30 } // namespace 31 } // namespace
31 32
32 class ErrorConsoleUnitTest : public testing::Test { 33 class ErrorConsoleUnitTest : public testing::Test {
33 public: 34 public:
34 ErrorConsoleUnitTest() : 35 ErrorConsoleUnitTest()
35 profile_(new TestingProfile), 36 : error_console_(ErrorConsole::Get(&profile_)) {
36 error_console_(ErrorConsole::Get(profile_.get())) {
37 } 37 }
38 virtual ~ErrorConsoleUnitTest() { } 38 virtual ~ErrorConsoleUnitTest() { }
39 39
40 protected: 40 protected:
41 scoped_ptr<TestingProfile> profile_; 41 content::TestBrowserThreadBundle thread_bundle_;
42 TestingProfile profile_;
42 ErrorConsole* error_console_; 43 ErrorConsole* error_console_;
43 }; 44 };
44 45
45 // Test adding errors, and removing them by reference, by incognito status, 46 // Test adding errors, and removing them by reference, by incognito status,
46 // and in bulk. 47 // and in bulk.
47 TEST_F(ErrorConsoleUnitTest, AddAndRemoveErrors) { 48 TEST_F(ErrorConsoleUnitTest, AddAndRemoveErrors) {
48 ASSERT_EQ(0u, error_console_->errors().size()); 49 ASSERT_EQ(0u, error_console_->errors().size());
49 50
50 const size_t kNumTotalErrors = 6; 51 const size_t kNumTotalErrors = 6;
51 const size_t kNumNonIncognitoErrors = 3; 52 const size_t kNumNonIncognitoErrors = 3;
(...skipping 13 matching lines...) Expand all
65 // Remove an error by address. 66 // Remove an error by address.
66 error_console_->RemoveError(error_console_->errors()[1]); 67 error_console_->RemoveError(error_console_->errors()[1]);
67 ASSERT_EQ(kNumNonIncognitoErrors - 1, error_console_->errors().size()); 68 ASSERT_EQ(kNumNonIncognitoErrors - 1, error_console_->errors().size());
68 69
69 // Remove all remaining errors. 70 // Remove all remaining errors.
70 error_console_->RemoveAllErrors(); 71 error_console_->RemoveAllErrors();
71 ASSERT_EQ(0u, error_console_->errors().size()); 72 ASSERT_EQ(0u, error_console_->errors().size());
72 } 73 }
73 74
74 } // namespace extensions 75 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698