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

Side by Side Diff: chrome/browser/extensions/api/extension_action/browser_action_browsertest.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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"
(...skipping 19 matching lines...) Expand all
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(
40 extension_id, 40 extension_id, kBrowserActionStorageKey,
41 kBrowserActionStorageKey, 41 base::Bind(&QuitMessageLoop, base::RetainedRef(runner)));
42 base::Bind(&QuitMessageLoop, runner));
43 runner->Run(); 42 runner->Run();
44 } 43 }
45 44
46 } // namespace 45 } // namespace
47 46
48 // Setup for the test by loading an extension, which should set the browser 47 // Setup for the test by loading an extension, which should set the browser
49 // action background to blue. 48 // action background to blue.
50 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, 49 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest,
51 PRE_BrowserActionDefaultPersistence) { 50 PRE_BrowserActionDefaultPersistence) {
52 ExtensionTestMessageListener listener("Background Color Set", 51 ExtensionTestMessageListener listener("Background Color Set",
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 LOG(WARNING) << "State store already initialized; test guaranteed to pass."; 107 LOG(WARNING) << "State store already initialized; test guaranteed to pass.";
109 108
110 // Wait for the StateStore to load, and fetch the defaults. 109 // Wait for the StateStore to load, and fetch the defaults.
111 WaitForStateStore(profile(), extension->id()); 110 WaitForStateStore(profile(), extension->id());
112 111
113 // Ensure the BrowserAction's badge background is still blue. 112 // Ensure the BrowserAction's badge background is still blue.
114 EXPECT_EQ(SK_ColorBLUE, extension_action->GetBadgeBackgroundColor(0)); 113 EXPECT_EQ(SK_ColorBLUE, extension_action->GetBadgeBackgroundColor(0));
115 } 114 }
116 115
117 } // namespace extensions 116 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/errorpage_browsertest.cc ('k') | chrome/browser/extensions/api/management/chrome_management_api_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698