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

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

Issue 2851103002: Update some host_resolver()->AddRules in chrome/browser. (Closed)
Patch Set: fix Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/automation/automation_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/callback.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 22 matching lines...) Expand all
33 class ActivityLogPrerenderTest : public ExtensionApiTest { 33 class ActivityLogPrerenderTest : public ExtensionApiTest {
34 protected: 34 protected:
35 // Make sure the activity log is turned on. 35 // Make sure the activity log is turned on.
36 void SetUpCommandLine(base::CommandLine* command_line) override { 36 void SetUpCommandLine(base::CommandLine* command_line) override {
37 ExtensionBrowserTest::SetUpCommandLine(command_line); 37 ExtensionBrowserTest::SetUpCommandLine(command_line);
38 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging); 38 command_line->AppendSwitch(switches::kEnableExtensionActivityLogging);
39 } 39 }
40 40
41 void SetUpOnMainThread() override { 41 void SetUpOnMainThread() override {
42 ExtensionApiTest::SetUpOnMainThread(); 42 ExtensionApiTest::SetUpOnMainThread();
43 host_resolver()->AddRule("*", "127.0.0.1");
43 prerender::PrerenderManager::SetOmniboxMode( 44 prerender::PrerenderManager::SetOmniboxMode(
44 prerender::PrerenderManager::PRERENDER_MODE_ENABLED); 45 prerender::PrerenderManager::PRERENDER_MODE_ENABLED);
45 } 46 }
46 47
47 static void Prerender_Arguments( 48 static void Prerender_Arguments(
48 const std::string& extension_id, 49 const std::string& extension_id,
49 uint16_t port, 50 uint16_t port,
50 const base::Closure& quit_when_idle_closure, 51 const base::Closure& quit_when_idle_closure,
51 std::unique_ptr<std::vector<scoped_refptr<Action>>> i) { 52 std::unique_ptr<std::vector<scoped_refptr<Action>>> i) {
52 quit_when_idle_closure.Run(); 53 quit_when_idle_closure.Run();
(...skipping 11 matching lines...) Expand all
64 ASSERT_EQ(base::StringPrintf("www.google.com.bo:%u/title1.html", port), 65 ASSERT_EQ(base::StringPrintf("www.google.com.bo:%u/title1.html", port),
65 last->page_title()); 66 last->page_title());
66 ASSERT_EQ("{\"prerender\":true}", 67 ASSERT_EQ("{\"prerender\":true}",
67 ActivityLogPolicy::Util::Serialize(last->other())); 68 ActivityLogPolicy::Util::Serialize(last->other()));
68 ASSERT_EQ("", last->api_name()); 69 ASSERT_EQ("", last->api_name());
69 ASSERT_EQ("", last->SerializeArgUrl()); 70 ASSERT_EQ("", last->SerializeArgUrl());
70 } 71 }
71 }; 72 };
72 73
73 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) { 74 IN_PROC_BROWSER_TEST_F(ActivityLogPrerenderTest, TestScriptInjected) {
74 host_resolver()->AddRule("*", "127.0.0.1");
75 ASSERT_TRUE(StartEmbeddedTestServer()); 75 ASSERT_TRUE(StartEmbeddedTestServer());
76 uint16_t port = embedded_test_server()->port(); 76 uint16_t port = embedded_test_server()->port();
77 77
78 // Get the extension (chrome/test/data/extensions/activity_log) 78 // Get the extension (chrome/test/data/extensions/activity_log)
79 const Extension* ext = 79 const Extension* ext =
80 LoadExtension(test_data_dir_.AppendASCII("activity_log")); 80 LoadExtension(test_data_dir_.AppendASCII("activity_log"));
81 ASSERT_TRUE(ext); 81 ASSERT_TRUE(ext);
82 82
83 ActivityLog* activity_log = ActivityLog::GetInstance(profile()); 83 ActivityLog* activity_log = ActivityLog::GetInstance(profile());
84 activity_log->SetWatchdogAppActiveForTesting(true); 84 activity_log->SetWatchdogAppActiveForTesting(true);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 activity_log->GetFilteredActions( 120 activity_log->GetFilteredActions(
121 ext->id(), Action::ACTION_ANY, "", "", "", -1, 121 ext->id(), Action::ACTION_ANY, "", "", "", -1,
122 base::Bind(ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port, 122 base::Bind(ActivityLogPrerenderTest::Prerender_Arguments, ext->id(), port,
123 run_loop.QuitWhenIdleClosure())); 123 run_loop.QuitWhenIdleClosure()));
124 124
125 // Allow invocation of Prerender_Arguments 125 // Allow invocation of Prerender_Arguments
126 run_loop.Run(); 126 run_loop.Run();
127 } 127 }
128 128
129 } // namespace extensions 129 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/automation/automation_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698