1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67

content / public / test / test_service.mojom [blame]

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module content.mojom;

import "mojo/public/mojom/base/file.mojom";
import "mojo/public/mojom/base/shared_memory.mojom";

const string kTestPipeKey = "content_test_pipe";

interface TestService {
  // Doesn't actually do anything, just responds.
  DoSomething() => ();

  // Terminates the current process to cause a connection error. Meant to test
  // a connection error for the utility process.
  DoTerminateProcess() => ();

  // Crashes the current process. Meant to test that crash notifications are
  // being sent correctly.
  DoCrashImmediately() => ();

  // Tries to create a temporary folder. Requires a sandbox to succeed.
  CreateFolder() => (bool succeeded);

  // Retrieve the requestor name as seen by the test app providing this service.
  GetRequestorName() => (string name);

  // Requests that a new read-only shared memory region be created and
  // returned. On success, |region| is valid and its contents match |message|'s
  // bytes exactly.
  CreateReadOnlySharedMemoryRegion(string message)
      => (mojo_base.mojom.ReadOnlySharedMemoryRegion? region);

  // Requests that a new writable shared memory region be created and
  // returned. On success, |region| is valid and its contents match |message|'s
  // bytes exactly.
  CreateWritableSharedMemoryRegion(string message)
      => (mojo_base.mojom.WritableSharedMemoryRegion? region);

  // Requests that a new unsafe shared memory region be created and returned.
  // On success, |region| is valid and its contents match |message|'s bytes
  // exactly.
  CreateUnsafeSharedMemoryRegion(string message)
      => (mojo_base.mojom.UnsafeSharedMemoryRegion? region);

  // Accepts a shared memory region and copies its contents into a new shared
  // memory region which is sent back to the caller. This exercises platform
  // handle transmission in both directions.
  CloneSharedMemoryContents(mojo_base.mojom.ReadOnlySharedMemoryRegion region)
      => (mojo_base.mojom.UnsafeSharedMemoryRegion new_region);

  // Returns the result of sandbox::policy::Sandbox::IsProcessSandboxed().
  IsProcessSandboxed() => (bool is_sandboxed);

  // Returns the value of PseudonymizeString for the given string.
  PseudonymizeString(string value) => (uint32 result);

  // Pass a writeable file handle. This is used to test that the file cannot be
  // passed if it can be opened with EXECUTE. See https://crbug.com/1335974.
  PassWriteableFile(mojo_base.mojom.File file) => ();

  // Writes to the pipe that should be stored in base::FileDescriptorStore with
  // the key kTestPipeKey.
  WriteToPreloadedPipe();
};