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

Side by Side Diff: chrome/browser/extensions/api/extension_action/browser_action_browsertest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "chrome/browser/extensions/extension_action.h" 7 #include "chrome/browser/extensions/extension_action.h"
8 #include "chrome/browser/extensions/extension_action_manager.h" 8 #include "chrome/browser/extensions/extension_action_manager.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "content/public/test/test_utils.h" 10 #include "content/public/test/test_utils.h"
11 #include "extensions/browser/extension_registry.h" 11 #include "extensions/browser/extension_registry.h"
12 #include "extensions/browser/extension_system.h" 12 #include "extensions/browser/extension_system.h"
13 #include "extensions/browser/state_store.h" 13 #include "extensions/browser/state_store.h"
14 #include "extensions/common/extension.h" 14 #include "extensions/common/extension.h"
15 #include "extensions/test/extension_test_message_listener.h" 15 #include "extensions/test/extension_test_message_listener.h"
16 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
17 17
18 namespace extensions { 18 namespace extensions {
19 19
20 namespace { 20 namespace {
21 21
22 // A key into the StateStore; we don't use any results, but need to know when 22 // A key into the StateStore; we don't use any results, but need to know when
23 // it's initialized. 23 // it's initialized.
24 const char kBrowserActionStorageKey[] = "browser_action"; 24 const char kBrowserActionStorageKey[] = "browser_action";
25 // The name of the extension we add. 25 // The name of the extension we add.
26 const char kExtensionName[] = "Default Persistence Test Extension"; 26 const char kExtensionName[] = "Default Persistence Test Extension";
27 27
28 void QuitMessageLoop(content::MessageLoopRunner* runner, 28 void QuitMessageLoop(content::MessageLoopRunner* runner,
29 scoped_ptr<base::Value> value) { 29 std::unique_ptr<base::Value> value) {
30 runner->Quit(); 30 runner->Quit();
31 } 31 }
32 32
33 // We need to wait for the state store to initialize and respond to requests 33 // We need to wait for the state store to initialize and respond to requests
34 // so we can see if the preferences persist. Do this by posting our own request 34 // so we can see if the preferences persist. Do this by posting our own request
35 // to the state store, which should be handled after all others. 35 // to the state store, which should be handled after all others.
36 void WaitForStateStore(Profile* profile, const std::string& extension_id) { 36 void WaitForStateStore(Profile* profile, const std::string& extension_id) {
37 scoped_refptr<content::MessageLoopRunner> runner = 37 scoped_refptr<content::MessageLoopRunner> runner =
38 new content::MessageLoopRunner; 38 new content::MessageLoopRunner;
39 ExtensionSystem::Get(profile)->state_store()->GetExtensionValue( 39 ExtensionSystem::Get(profile)->state_store()->GetExtensionValue(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 LOG(WARNING) << "State store already initialized; test guaranteed to pass."; 107 LOG(WARNING) << "State store already initialized; test guaranteed to pass.";
108 108
109 // Wait for the StateStore to load, and fetch the defaults. 109 // Wait for the StateStore to load, and fetch the defaults.
110 WaitForStateStore(profile(), extension->id()); 110 WaitForStateStore(profile(), extension->id());
111 111
112 // Ensure the BrowserAction's badge background is still blue. 112 // Ensure the BrowserAction's badge background is still blue.
113 EXPECT_EQ(SK_ColorBLUE, extension_action->GetBadgeBackgroundColor(0)); 113 EXPECT_EQ(SK_ColorBLUE, extension_action->GetBadgeBackgroundColor(0));
114 } 114 }
115 115
116 } // namespace extensions 116 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698