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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_browsertest.cc

Issue 2315443004: Remove calls to deprecated MessageLoop methods in chrome. (Closed)
Patch Set: remove unused include Created 4 years, 3 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/callback.h"
7 #include "base/location.h" 8 #include "base/location.h"
8 #include "base/run_loop.h" 9 #include "base/run_loop.h"
9 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
10 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
11 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/browser/extensions/activity_log/activity_log.h" 12 #include "chrome/browser/extensions/activity_log/activity_log.h"
13 #include "chrome/browser/extensions/extension_apitest.h" 13 #include "chrome/browser/extensions/extension_apitest.h"
14 #include "chrome/browser/extensions/extension_browsertest.h" 14 #include "chrome/browser/extensions/extension_browsertest.h"
15 #include "chrome/browser/prerender/prerender_handle.h" 15 #include "chrome/browser/prerender/prerender_handle.h"
16 #include "chrome/browser/prerender/prerender_manager.h" 16 #include "chrome/browser/prerender/prerender_manager.h"
17 #include "chrome/browser/prerender/prerender_manager_factory.h" 17 #include "chrome/browser/prerender/prerender_manager_factory.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "content/public/test/browser_test_utils.h" 21 #include "content/public/test/browser_test_utils.h"
(...skipping 13 matching lines...) Expand all
35 void SetUpCommandLine(base::CommandLine* command_line) override { 35 void SetUpCommandLine(base::CommandLine* command_line) override {
36 ExtensionBrowserTest::SetUpCommandLine(command_line); 36 ExtensionBrowserTest::SetUpCommandLine(command_line);
37 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging); 37 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging);
38 command_line->AppendSwitchASCII(switches::kPrerenderMode, 38 command_line->AppendSwitchASCII(switches::kPrerenderMode,
39 switches::kPrerenderModeSwitchValueEnabled); 39 switches::kPrerenderModeSwitchValueEnabled);
40 } 40 }
41 41
42 static void Prerender_Arguments( 42 static void Prerender_Arguments(
43 const std::string& extension_id, 43 const std::string& extension_id,
44 uint16_t port, 44 uint16_t port,
45 const base::Closure& quit_when_idle_closure,
45 std::unique_ptr<std::vector<scoped_refptr<Action>>> i) { 46 std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
46 // This is to exit RunLoop (base::MessageLoop::current()->Run()) below 47 quit_when_idle_closure.Run();
47 base::ThreadTaskRunnerHandle::Get()->PostTask(
48 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
49 48
50 ASSERT_TRUE(i->size()); 49 ASSERT_TRUE(i->size());
51 scoped_refptr<Action> last = i->front(); 50 scoped_refptr<Action> last = i->front();
52 51
53 ASSERT_EQ(extension_id, last->extension_id()); 52 ASSERT_EQ(extension_id, last->extension_id());
54 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type()); 53 ASSERT_EQ(Action::ACTION_CONTENT_SCRIPT, last->action_type());
55 ASSERT_EQ("[\"/google_cs.js\"]", 54 ASSERT_EQ("[\"/google_cs.js\"]",
56 ActivityLogPolicy::Util::Serialize(last->args())); 55 ActivityLogPolicy::Util::Serialize(last->args()));
57 ASSERT_EQ( 56 ASSERT_EQ(
58 base::StringPrintf("http://www.google.com.bo:%u/title1.html", port), 57 base::StringPrintf("http://www.google.com.bo:%u/title1.html", port),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 104
106 const gfx::Size kSize(640, 480); 105 const gfx::Size kSize(640, 480);
107 std::unique_ptr<prerender::PrerenderHandle> prerender_handle( 106 std::unique_ptr<prerender::PrerenderHandle> prerender_handle(
108 prerender_manager->AddPrerenderFromOmnibox( 107 prerender_manager->AddPrerenderFromOmnibox(
109 url, 108 url,
110 web_contents->GetController().GetDefaultSessionStorageNamespace(), 109 web_contents->GetController().GetDefaultSessionStorageNamespace(),
111 kSize)); 110 kSize));
112 111
113 page_observer.Wait(); 112 page_observer.Wait();
114 113
114 base::RunLoop run_loop;
115 activity_log->GetFilteredActions( 115 activity_log->GetFilteredActions(
116 ext->id(), 116 ext->id(), Action::ACTION_ANY, "", "", "", -1,
117 Action::ACTION_ANY, 117 base::Bind(ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port,
118 "", 118 run_loop.QuitWhenIdleClosure()));
119 "",
120 "",
121 -1,
122 base::Bind(
123 ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port));
124 119
125 // Allow invocation of Prerender_Arguments 120 // Allow invocation of Prerender_Arguments
126 base::RunLoop().Run(); 121 run_loop.Run();
127 } 122 }
128 123
129 } // namespace extensions 124 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698